Message ID | Z7XWRfRi3Fn25wT4Dg19JRN4xrKcCt3TxaxZwsR_0LDR2C6fQxCiLrsMBfJg8f_ZqSAx3u6aPm-TR02dC6bLpMmqSI_jp_ADiJ_qW_27puk=@ethancedwards.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | dm: change kzalloc to kcalloc | expand |
On 24/12/24 16:13, Ethan Carter Edwards wrote: > Use 2-factor multiplication argument form kcalloc() instead > of instead of the deprecated kzalloc() [1]. Thanks for the patch - Just note that kzalloc() is by no means deprecated. > > [1] https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments > Link: https://github.com/KSPP/linux/issues/162 > > Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> -Gustavo > --- > drivers/md/dm-ps-io-affinity.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/md/dm-ps-io-affinity.c b/drivers/md/dm-ps-io-affinity.c > index 461ee6b2044d..716807e511ee 100644 > --- a/drivers/md/dm-ps-io-affinity.c > +++ b/drivers/md/dm-ps-io-affinity.c > @@ -116,7 +116,7 @@ static int ioa_create(struct path_selector *ps, unsigned int argc, char **argv) > if (!s) > return -ENOMEM; > > - s->path_map = kzalloc(nr_cpu_ids * sizeof(struct path_info *), > + s->path_map = kcalloc(nr_cpu_ids, sizeof(struct path_info *), > GFP_KERNEL); > if (!s->path_map) > goto free_selector;
diff --git a/drivers/md/dm-ps-io-affinity.c b/drivers/md/dm-ps-io-affinity.c index 461ee6b2044d..716807e511ee 100644 --- a/drivers/md/dm-ps-io-affinity.c +++ b/drivers/md/dm-ps-io-affinity.c @@ -116,7 +116,7 @@ static int ioa_create(struct path_selector *ps, unsigned int argc, char **argv) if (!s) return -ENOMEM; - s->path_map = kzalloc(nr_cpu_ids * sizeof(struct path_info *), + s->path_map = kcalloc(nr_cpu_ids, sizeof(struct path_info *), GFP_KERNEL); if (!s->path_map) goto free_selector;
Use 2-factor multiplication argument form kcalloc() instead of instead of the deprecated kzalloc() [1]. [1] https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Link: https://github.com/KSPP/linux/issues/162 Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com> --- drivers/md/dm-ps-io-affinity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)