Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2608442pxt; Mon, 9 Aug 2021 04:54:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxpaoHepsPFwvR3XuufhkAZF+Jd3A+ejgnomQmxTYlX7p/yv0uiYzLFs33IpVL2a/fXRec X-Received: by 2002:a92:7d07:: with SMTP id y7mr30468ilc.68.1628510083933; Mon, 09 Aug 2021 04:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628510083; cv=none; d=google.com; s=arc-20160816; b=Sb1R9176EKBw4fvEqzv3/oq7Xye8scIpMGZzrl+mQ/5zyQisBGctkNrPhlwc+DVYbe 3bwBr5gF9Z3sFVU0xhI2z/FuyxxLWlAah2k1QrZO8wQU+rUhhaLSWxHMgLrZIqtazxeT srR7atJVeShphhQ7mcN+CY4iJmY6/oUqA+ZtkMcBsx4ntMf951UVO5XG736e0YZLG5w/ qQc4jSD9FwlAaUePKbFGl3EEytxDVsJX0LgSS/0+k+YxVCnalqKrJ8ON2mC0ZF/t1e7m foKSS6dHobGI9iNJApebMpmGJmw1HqrnB7jbWaJNlc0zEWHp3tZVOu8u7MkdkrI1IuQP IdjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=raU8VOLLGU+iWombxhbZIWq5VwcSWZBfhd3dahNTcGk=; b=vlMIffcvPcamN1KpKQByzAEuORxLstrgilqB1iVwVQzpCYrGmTBLuLswFiYBn1E4NL m+kI8beu3Mr1KHkAeEBL1ws/l7oGOYiI200oxMMHObELckIodPbuO3cvTuQXHKNHud7b q8vQwI2UIk8xNpgwviFsv5NvtlacbUICXj7E7ZDda7d0kD2ywL/K2Hq8O10ideHtB38Z 3QgcAkUwFd+fOYOcVwm6aWcrz38fzJhSV/ZmgyxZsPfunXvMBN23Ct1Djq4cQpIn99AJ Q4HIHbf7V4yiMJ4KsyNhVQrNmBCA8l/CJh8mfIJ02yMfNvEkLqb+yIDPhHXPR1RC7z68 5pkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f3RMWC0+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v31si8091718jal.55.2021.08.09.04.54.31; Mon, 09 Aug 2021 04:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f3RMWC0+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233156AbhHIJwU (ORCPT + 99 others); Mon, 9 Aug 2021 05:52:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232944AbhHIJwT (ORCPT ); Mon, 9 Aug 2021 05:52:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC75660EC0; Mon, 9 Aug 2021 09:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628502719; bh=J8CUNEQlMchF5+n7xZbUyoke5OF5A74gsFwrK7af7y0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f3RMWC0+7MgMSfZj6xCZn+lUbkU9ibVvYHQ6tgUukCmO3/1yrgmitXvG4noCskVzW n7VuOhJZMycvg09Ym9IQzlMgkISWZjXOGlCeSz7y0pvb+f5ShDI3pD9GSAIoIemneN z8pAALIuXCn9ywONxPxkBNeHq27P48oD5okxPe+SpAOr9Z3k0iRVe+nJxEPCGjkjhl w0JD1t7qx7jZy/xhGKyKuTkvCa257y5BvPwp1gPsn5UfEuL2iaCxqLpMVcG64DFKQm Lq3GIBv1Gtgb6m3xENFnVtciRY2j95pHfsQ24iech0XbiGZuKN2gnBfdFh4XVEV7jS YiGfQDomvWkGQ== Date: Mon, 9 Aug 2021 11:51:54 +0200 From: Robert Richter To: Len Baker Cc: Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , Kees Cook , linux-hardening@vger.kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] drivers/edac/edac_mc: Remove all strcpy() uses Message-ID: References: <20210807155957.10069-1-len.baker@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210807155957.10069-1-len.baker@gmx.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07.08.21 17:59:57, Len Baker wrote: > @@ -1113,11 +1115,11 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, > p = e->label; > *p = '\0'; > } else { > - if (p != e->label) { > - strcpy(p, OTHER_LABEL); > - p += strlen(OTHER_LABEL); > - } > - strcpy(p, dimm->label); > + const char *text = (p != e->label) ? OTHER_LABEL : > + dimm->label; > + > + strscpy(p, text, len); > + len -= strlen(p); The logic looks broken and dimm labels are not properly copied (the code should add an " or " separator between labels). -Robert > p += strlen(p); > } >