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
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220527082352.GP2168@kadam>
Date:   Fri, 27 May 2022 11:23:52 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Shijith Thotton <sthotton@...vell.com>
Cc:     Arnaud Ebalard <arno@...isbad.org>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Boris Brezillon <bbrezillon@...nel.org>,
        linux-crypto@...r.kernel.org, jerinj@...vell.com,
        sgoutham@...vell.com, Srujana Challa <schalla@...vell.com>,
        "David S. Miller" <davem@...emloft.net>,
        Harman Kalra <hkalra@...vell.com>,
        Yang Yingliang <yangyingliang@...wei.com>,
        Kees Cook <keescook@...omium.org>,
        Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] crypto: octeontx2: fix potential null pointer access

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ