Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2992519pxj; Sun, 23 May 2021 18:08:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM/5VrVPhXhgOkzEZWwEtDs7fucnUAXVTJffoctemMTWf0zPPwjDK9MX+jYZDhhkZEVH5M X-Received: by 2002:a17:906:c0da:: with SMTP id bn26mr2807725ejb.437.1621818538558; Sun, 23 May 2021 18:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621818538; cv=none; d=google.com; s=arc-20160816; b=dF40c04XAXF9k1gCG4nzF77doILSJLir01yC+S7Ubn2AS5anZ4c203wdp6H9x22hlR zfwdVrmQ0EUo+RSDL/+8qHkgUy5v0gsMRTEP+jaFMM9BEpTEMeT5ZfnvmEaZWUuNjIzm fyJMw23+vY5F5UhA8tvF0646JmGH83vOMYwr4wmn6so+zbbcNyjfZPg1IAn5C6+L+GL5 o7XQEyaMvlO0CnEH/mQuKez2PGdFW+qMVLp5Og1YskX+Tp44tfs+CMnRfnTmamfuVUr6 pGfPvBFUGBynES0DAq76Mcv3yNxyqC6nP8fgWneJhKvx2YofY3Yw/s9Mg+vpTE2+u7pt 3Tgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=7p6G+xICMAz4SDx664uc78kFJhKR4BSbV98TZryPCdI=; b=WvBgzcDDz3KEkCj+ZlN+09Vw+8Iz3HH9CtrPVoHUEe4c6b9HsUXCixt8IlSgAqCFV1 LTD4JbWFPp6O6WRNX1b5JmTJpIXv9fO5N11QIMIXeGXRyPL0RMVAAqf/lClfWt7mcyA8 PmmURrS+9SgKCkQHwBcTVBiZMq/v3i9OqTFOXQZiIVKKGIwm1rkAGhaSDGaE1ERFMAyU jieqqgxGxziJ34chleDHUSHzTdbM+Y5nUbWYLhfsTV3NYjYhaXx5f97MpQaLAY+9ZPNn JQmG/v/h6iZT/eyIUsBpC6/jjk4XmRg0YV/OTsD9GM2gm2KxNaZ3arOqb93U2M1rRTBO IaNg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n5si1536723ejj.89.2021.05.23.18.08.34; Sun, 23 May 2021 18:08:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232120AbhEXBJL (ORCPT + 99 others); Sun, 23 May 2021 21:09:11 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:3916 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232060AbhEXBJL (ORCPT ); Sun, 23 May 2021 21:09:11 -0400 Received: from dggems705-chm.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FpJsH0VrrzBtrf; Mon, 24 May 2021 09:04:51 +0800 (CST) Received: from dggema769-chm.china.huawei.com (10.1.198.211) by dggems705-chm.china.huawei.com (10.3.19.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 24 May 2021 09:07:41 +0800 Received: from [10.174.179.215] (10.174.179.215) by dggema769-chm.china.huawei.com (10.1.198.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 24 May 2021 09:07:40 +0800 Subject: Re: [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy To: Andrew Lunn , Christophe Leroy CC: , , , , , , References: <20210523075616.14792-1-yuehaibing@huawei.com> <20210523152937.Horde.5kC0kzvaP3No5BC63LlZ_A7@messagerie.c-s.fr> From: YueHaibing Message-ID: Date: Mon, 24 May 2021 09:07:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggema769-chm.china.huawei.com (10.1.198.211) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/23 22:26, Andrew Lunn wrote: > On Sun, May 23, 2021 at 03:29:37PM +0200, Christophe Leroy wrote: >> YueHaibing a écrit : >> >>> Issue identified with Coccinelle. >>> >>> Signed-off-by: YueHaibing >>> --- >>> drivers/net/ethernet/freescale/ucc_geth.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c >>> b/drivers/net/ethernet/freescale/ucc_geth.c >>> index e0936510fa34..51206272cc25 100644 >>> --- a/drivers/net/ethernet/freescale/ucc_geth.c >>> +++ b/drivers/net/ethernet/freescale/ucc_geth.c >>> @@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct >>> platform_device* ofdev) >>> if ((ucc_num < 0) || (ucc_num > 7)) >>> return -ENODEV; >>> >>> - ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL); >>> + ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info), >>> + GFP_KERNEL); >> >> Can you keep that as a single line ? The tolerance is 100 chars per line now. > > Networking prefers 80. If it fits a single 80 char line, please use a single line. > Otherwise please leave it as it is. Ok, will send v2. > > Andrew > . >