Re: [PATCH] Staging/comedi: Fixes static analysis warning raised by sparse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 15, 2014 at 09:32:27PM +0200, Sam Ravnborg wrote:
> diff --git a/expand.c b/expand.c
> index 0f6720c..4a96de4 100644
> --- a/expand.c
> +++ b/expand.c
> @@ -187,7 +187,7 @@ static int simplify_int_binop(struct expression *expr, struct symbol *ctype)
>  		return 0;
>  	r = right->value;
>  	if (expr->op == SPECIAL_LEFTSHIFT || expr->op == SPECIAL_RIGHTSHIFT) {
> -		if (r >= ctype->bit_size) {
> +		if (expr->flags & Int_const_expr && r >= ctype->bit_size) {

Thanks!  I had no idea how to start writing a fix for this, but the test
should be:
		if (expr->right->flags & Int_const_expr

Otherwise both sides of the shift have to be const.

>  			if (conservative)
>  				return 0;
>  			r = check_shift_count(expr, ctype, r);
> 

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux