Re: [PATCH] hid-core: fix s32 to n function when n=32

From: Jiri Kosina
Date: Fri May 29 2015 - 10:47:55 EST


On Thu, 21 May 2015, Samet, Yael wrote:

> In hid-core.c, s32ton function, when n in 32 the result will always be 0.
> In the last line of the function:
> 1 << 32 is not defined,
> I get 1 in my environment, Then ((1 << n) - 1) is 0, and the function returns 0 for each value.
>
> Signed-off-by: Yael Samet <yael.samet@xxxxxxxxx>
>
> --- hid-core.c 2015-05-21 10:49:39.000000000 +0300
> +++ hid-core.c.pathced 2015-05-21 11:02:29.692431045 +0300

This is not a proper format to submit patches, please see
Documentation/SubmittingPatches.

> @@ -1044,6 +1044,8 @@
> static u32 s32ton(__s32 value, unsigned n)
> {
> s32 a = value >> (n - 1);
> + if (n == 32)
> + return value;
> if (a && a != -1)
> return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1;
> return value & ((1 << n) - 1);

The patch is whitespace-damaged. Could you please fix your mail setup and
resend?

> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited.

Seems like I wouldn't be allowed to apply it anyway though :p

--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/