From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14B0928F1 for ; Mon, 23 Dec 2024 03:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734924751; cv=none; b=BoeyTqn9sPJcLDFKevuo7CvcNzYY/9sdL9tfc+chTlr72nVytD/wETAViixXXVBAtAOXu1E1Do1mfyqFnsCZlaJOb0e4t6zYS22oNjLHzO837OsvMCAD7E4KH1N9Ykw562/nWkv1c0m2cbLGoB4HF4FN6m87ZNtzEaZf7/3OW7I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734924751; c=relaxed/simple; bh=5oDNf2M/nYQNu3KZ5My1HlVJqlImFAioGoFTkfbCHYc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=B8HANRIxr9TtAGXc/QYJ+OwkeUCD5o3/M7b7RpjSYOf6sgJiMF6YgHmkpoATWRkJYKmxgue8Tn5sJ7ctDReROwmBftF089PMdZuySuYSVc7jSJY9pq3T872QXW4go88tLEDQ6K9lFcrYQE5+YaPTtqD3tdi6hKtObUrDHuxSMrU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=dtTcopfc; arc=none smtp.client-ip=115.124.30.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="dtTcopfc" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1734924740; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=98fNWy5yCdP/W+2vnKIHC6AxFhaLbCoz9BL1fmQsfns=; b=dtTcopfc8cBs+6Q+eYZGJhqCE2CkXksyC7/6JJ19Q4HxnkBNF8j776QBwElcDo2pI+3aDr6L6doobnj2ib7+arxDATR51x56+f4IwWfQKTgC9Kc+/oK1z9kUGSRQw7XNf2izI3Nv+Gq04ccLezEQHQrnweUXbPUF1sxcMU+eDpc= Received: from 30.221.130.83(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0WM-EY0z_1734924739 cluster:ay36) by smtp.aliyun-inc.com; Mon, 23 Dec 2024 11:32:20 +0800 Message-ID: <80a3e6ab-839e-47b6-9554-fbaf330ab4b8@linux.alibaba.com> Date: Mon, 23 Dec 2024 11:32:19 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] fs: erofs: xattr.c change kzalloc to kcalloc To: Ethan Carter Edwards , "xiang@kernel.org" Cc: "zbestahu@gmail.com" , "linux-erofs@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" References: From: Gao Xiang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/12/23 11:00, Ethan Carter Edwards wrote: > From 272d7ef4611e64269fada0ea3021eece590118b9 Mon Sep 17 00:00:00 2001 > From: Ethan Carter Edwards > Date: Sun, 22 Dec 2024 21:23:56 -0500 > Subject: [PATCH] fs: erofs: xattr.c change kzalloc to kcalloc > > Refactor xattr.c to use kcalloc instead of kzalloc when multiplying > allocation size by count. This refactor prevents unintentional > memory overflows. Discovered by checkpatch.pl. > > Signed-off-by: Ethan Carter Edwards Reviewed-by: Gao Xiang Although your raw patch format is incorrect. You shouldn't send the whole patch as the content, but just use `git send-email` to send the patch. I've fixed it up manually, no need to resend. Thanks, Gao Xiang > --- > fs/erofs/xattr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c > index a90d7d649739..7940241d9355 100644 > --- a/fs/erofs/xattr.c > +++ b/fs/erofs/xattr.c > @@ -478,7 +478,7 @@ int erofs_xattr_prefixes_init(struct super_block *sb) > if (!sbi->xattr_prefix_count) > return 0; > > - pfs = kzalloc(sbi->xattr_prefix_count * sizeof(*pfs), GFP_KERNEL); > + pfs = kcalloc(sbi->xattr_prefix_count, sizeof(*pfs), GFP_KERNEL); > if (!pfs) > return -ENOMEM; >