[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240104140838.GF14858@ediswmail.ad.cirrus.com>
Date: Thu, 4 Jan 2024 14:08:38 +0000
From: Charles Keepax <ckeepax@...nsource.cirrus.com>
To: Dmitry Antipov <dmantipov@...dex.ru>
CC: Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman
<gregkh@...uxfoundation.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] regmap: fix kcalloc() arguments order
On Wed, Dec 20, 2023 at 08:58:19PM +0300, Dmitry Antipov wrote:
> When compiling with gcc version 14.0.0 20231220 (experimental)
> and W=1, I've noticed a bunch of four similar warnings like:
>
> drivers/base/regmap/regmap-ram.c: In function '__regmap_init_ram':
> drivers/base/regmap/regmap-ram.c:68:37: warning: 'kcalloc' sizes specified with
> 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
> 68 | data->read = kcalloc(sizeof(bool), config->max_register + 1,
> | ^~~~
>
> Since 'n' and 'size' arguments of 'kcalloc()' are multiplied to
> calculate the final size, their actual order doesn't affect the
> result and so this is not a bug. But it's still worth to fix it.
>
> Signed-off-by: Dmitry Antipov <dmantipov@...dex.ru>
> ---
Reviewed-by: Charles Keepax <ckeepax@...nsource.cirrus.com>
Thanks,
Charles
Powered by blists - more mailing lists