From: Dan Carpenter <dan.carpenter@oracle.com>
To: Shijith Thotton <sthotton@marvell.com>
Cc: Arnaud Ebalard <arno@natisbad.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Boris Brezillon <bbrezillon@kernel.org>,
linux-crypto@vger.kernel.org, jerinj@marvell.com,
sgoutham@marvell.com, Srujana Challa <schalla@marvell.com>,
"David S. Miller" <davem@davemloft.net>,
Harman Kalra <hkalra@marvell.com>,
Yang Yingliang <yangyingliang@huawei.com>,
Kees Cook <keescook@chromium.org>,
Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] crypto: octeontx2: fix potential null pointer access
Date: Fri, 27 May 2022 11:23:52 +0300 [thread overview]
Message-ID: <20220527082352.GP2168@kadam> (raw)
In-Reply-To: <da89ba20819ad3ca6b99f9ef056f2bc1b076dc6d.1653632699.git.sthotton@marvell.com>
On Fri, May 27, 2022 at 01:27:56PM +0530, Shijith Thotton wrote:
> diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
> index 9cba2f714c7e..b91401929fc6 100644
> --- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
> +++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
> @@ -1605,7 +1605,11 @@ int otx2_cpt_dl_custom_egrp_create(struct otx2_cptpf_dev *cptpf,
> if (!strncasecmp(val, "se", 2) && strchr(val, ':')) {
> if (has_se || ucode_idx)
> goto err_print;
> - tmp = strim(strsep(&val, ":"));
> + tmp = strsep(&val, ":");
> + if (tmp != NULL)
> + tmp = strim(tmp);
> + else
> + goto err_print;
The check is not needed here, but if it were then the better way to
write this would be:
tmp = strsep(&val, ":");
if (!tmp)
goto err_print;
tmp = strim(tmp);
Always to error handling, not success handling. checkpatch.pl --strict
will complain about the != NULL.
regards,
dan carpenter
next prev parent reply other threads:[~2022-05-27 8:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 7:57 [PATCH] crypto: octeontx2: fix potential null pointer access Shijith Thotton
2022-05-27 8:19 ` Dan Carpenter
2022-05-27 9:40 ` [EXT] " Shijith Thotton
2022-05-27 10:04 ` Dan Carpenter
2022-05-27 11:14 ` Shijith Thotton
2022-05-27 8:23 ` Dan Carpenter [this message]
2022-05-27 9:42 ` Shijith Thotton
2022-06-01 8:08 ` [PATCH v2] " Shijith Thotton
2022-06-10 9:16 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220527082352.GP2168@kadam \
--to=dan.carpenter@oracle.com \
--cc=arno@natisbad.org \
--cc=bbrezillon@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=hkalra@marvell.com \
--cc=jerinj@marvell.com \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=keescook@chromium.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=schalla@marvell.com \
--cc=sgoutham@marvell.com \
--cc=sthotton@marvell.com \
--cc=yangyingliang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox