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: <20130519183041.GB30128@mwanda>
Date:	Sun, 19 May 2013 21:30:41 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Dimitri Sivanich <sivanich@....com>
Cc:	Robin Holt <holt@....com>, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [patch] gru: fix a sanity test in gru_set_context_option()

On Sun, May 19, 2013 at 09:44:42AM -0500, Dimitri Sivanich wrote:
> 
> Since we're here, maybe we should neaten this up a little?
> 
> Signed-off-by: Dimitri Sivanich <sivanich@....com>
> ---
>  drivers/misc/sgi-gru/grufault.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Index: linux/drivers/misc/sgi-gru/grufault.c
> ===================================================================
> --- linux.orig/drivers/misc/sgi-gru/grufault.c
> +++ linux/drivers/misc/sgi-gru/grufault.c
> @@ -876,8 +876,9 @@ int gru_set_context_option(unsigned long
>  	switch (req.op) {
>  	case sco_blade_chiplet:
>  		/* Select blade/chiplet for GRU context */
> -		if (req.val1 < -1 || req.val1 >= GRU_MAX_BLADES || !gru_base[req.val1] ||
> -		    req.val0 < -1 || req.val0 >= GRU_CHIPLETS_PER_HUB) {
> +		if (req.val0 < -1 || req.val0 >= GRU_CHIPLETS_PER_HUB ||
> +			req.val1 < -1 || req.val1 >= GRU_MAX_BLADES ||
> +			(req.val1 >= 0 && !gru_base[req.val1])) {
>  			ret = -EINVAL;

I generally prefer how in the original code all the sub conditions
were aligned nicely but I will Ack your version as well.  Thanks.

regards,
dan carpenter

>  		} else {
>  			gts->ts_user_blade_id = req.val1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ