Re: [PATCH] scsi: Use vzalloc instead of vmalloc/memset

From: Luis R. Rodriguez
Date: Tue Nov 07 2017 - 14:51:42 EST


On Sun, Nov 05, 2017 at 03:26:26AM +0530, Himanshu Jha wrote:
> Use vzalloc instead of vmalloc/memset to allocate memory filled with 0
> value.
>
> Done using Coccinelle.
> Semantic patch used :
>
> @@
> expression x,a;
> statement S;
> @@
>
> - x = vmalloc(a);
> + x = vzalloc(a);
> if (x == NULL || ...) S
> - memset(x, 0, a);

How many false positives do you get? Have you identified any?
If not you should consider adding this SmPL rule to:

scripts/coccinelle/api/

Some maintainers may ask you for the SmPL rule to be upstream first,
not all though. So its good practice for you to strive for this.
Another reason for it to go upstream is then other maintainers
can / should be running coccicheck against their subsystem to avoid
stupid regressions.

You may want to explain for patches like these that they have been
tested by 0-day without any issues found.

Also add the tag:

Generated-by: Coccinelle SmPL

> Signed-off-by: Himanshu Jha <himanshujha199640@xxxxxxxxx>
> ---
> drivers/scsi/bfa/bfad.c | 3 +--
> drivers/scsi/bfa/bfad_debugfs.c | 8 ++------
> drivers/scsi/qla2xxx/qla_bsg.c | 3 +--
> drivers/scsi/qla2xxx/tcm_qla2xxx.c | 5 +----
> drivers/scsi/scsi_debug.c | 6 ++----
> drivers/scsi/snic/snic_trc.c | 3 +--
> 6 files changed, 8 insertions(+), 20 deletions(-)

Split this up per driver, and resend by using ./scripts/get_maintainer.pl
foo.patch and ensuring the right folks get the email. Right now you
just spammed tons of people and the changes may be preferred to go
upstream atomically per driver, always assume this first.

Other than this, feel free to add to each of the patches you created:

Acked-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxx>