lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 6 Jun 2022 08:33:24 -0500 From: Eddie James <eajames@...ux.ibm.com> To: Ziyang Xuan <william.xuanziyang@...wei.com>, jdelvare@...e.com, linux@...ck-us.net, joel@....id.au, penberg@...nel.org, akpm@...ux-foundation.org, linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH] hwmon: (occ) Delete unnecessary NULL check On 6/6/22 08:14, Ziyang Xuan wrote: > kvfree(NULL) is safe. NULL check before kvfree() is not needed. > Delete them to simplify the code. > > Generated by coccinelle script: > scripts/coccinelle/free/ifnullfree.cocci Thanks for the patch! Reviewed-by: Eddie James <eajames@...ux.ibm.com> > > Signed-off-by: Ziyang Xuan <william.xuanziyang@...wei.com> > --- > drivers/hwmon/occ/p9_sbe.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c > index 42fc7b97bb34..01405ae2f9bd 100644 > --- a/drivers/hwmon/occ/p9_sbe.c > +++ b/drivers/hwmon/occ/p9_sbe.c > @@ -55,8 +55,7 @@ static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp, > mutex_lock(&ctx->sbe_error_lock); > if (!ctx->sbe_error) { > if (resp_len > ctx->ffdc_size) { > - if (ctx->ffdc) > - kvfree(ctx->ffdc); > + kvfree(ctx->ffdc); > ctx->ffdc = kvmalloc(resp_len, GFP_KERNEL); > if (!ctx->ffdc) { > ctx->ffdc_len = 0; > @@ -171,8 +170,7 @@ static int p9_sbe_occ_remove(struct platform_device *pdev) > ctx->sbe = NULL; > occ_shutdown(occ); > > - if (ctx->ffdc) > - kvfree(ctx->ffdc); > + kvfree(ctx->ffdc); > > return 0; > }
Powered by blists - more mailing lists