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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <308957d91294ec1883ec492eecb8ffe1d51a0689.camel@perches.com>
Date:   Mon, 25 Jun 2018 19:29:59 -0700
From:   Joe Perches <joe@...ches.com>
To:     Chengguang Xu <cgxu519@....com>, jakub.kicinski@...ronome.com,
        davem@...emloft.net
Cc:     oss-drivers@...ronome.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net] nfp: cast sizeof() to int when comparing with
 error code

On Tue, 2018-06-26 at 09:16 +0800, Chengguang Xu wrote:
> sizeof() will return unsigned value so in the error check
> negative error code will be always larger than sizeof().
[]
> diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nffw.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nffw.c
[]
> @@ -232,7 +232,7 @@ struct nfp_nffw_info *nfp_nffw_info_open(struct nfp_cpp *cpp)
>  	err = nfp_cpp_read(cpp, nfp_resource_cpp_id(state->res),
>  			   nfp_resource_address(state->res),
>  			   fwinf, sizeof(*fwinf));
> -	if (err < sizeof(*fwinf))
> +	if (err < (int)sizeof(*fwinf))
>  		goto err_release;
>  
>  	if (!nffw_res_flg_init_get(fwinf))

The way this is done in several places in the kernel is
to test first for < 0 and then test for < sizeof

	if (err < 0 || err < sizeof(etc...)

see net/ceph/ceph_common.c etc...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ