Re: [PATCH] PM/CORE: Fix using sizeof without parenthesis in the sysfs.c

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

 



On 28 January 2013 08:31, Lan Tianyu <tianyu.lan@xxxxxxxxx> wrote:
> -       if (len == sizeof ctrl_auto - 1 && strncmp(buf, ctrl_auto, len) == 0)
> +       if (len == sizeof(ctrl_auto - 1) && strncmp(buf, ctrl_auto, len) == 0)

This looks wrong to me.
sizeof ctrl_auto - 1
is not the same value as
sizeof(ctrl_auto - 1)
because sizeof(x) is normally the same as sizeof(x - 1), unless sizeof
x and sizeof 1 are different.
Consider that is maybe should be:
if (len == (sizeof(ctrl_auto) - 1)) && strncmp(buf, ctrl_auto, len) == 0)

I a not sure what the correct answer is for this particular bit of
code, because I have not looked at it in detail,I just wanted to point
out that the brackets might be in the wrong place here.

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


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux