From: Lan Tianyu <lantianyu1986@gmail.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: James Courtier-Dutton <james.dutton@gmail.com>,
Lan Tianyu <tianyu.lan@intel.com>,
linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH] PM/CORE: Fix using sizeof without parenthesis in the sysfs.c
Date: Mon, 28 Jan 2013 21:04:29 +0800 [thread overview]
Message-ID: <5106775D.1080101@gmail.com> (raw)
In-Reply-To: <3030648.5OBcUztiBY@vostro.rjw.lan>
于 2013/1/28 20:18, Rafael J. Wysocki 写道:
> On Monday, January 28, 2013 09:03:28 AM James Courtier-Dutton wrote:
>> On 28 January 2013 08:31, Lan Tianyu <tianyu.lan@intel.com> 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)
Hi James:
Yes. You are correct. Thanks for your review.
>
> The outer parentheses in the comparison with len are not necessary.
>
>> 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.
>
> You are right and the patch doesn't make sense.
Hi Rafael:
So this patch is not necessary?
>
> Thanks,
> Rafael
>
>
--
Best regards
Tianyu Lan
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-01-28 13:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-28 8:31 [PATCH] PM/CORE: Fix using sizeof without parenthesis in the sysfs.c Lan Tianyu
2013-01-28 9:03 ` James Courtier-Dutton
2013-01-28 12:18 ` Rafael J. Wysocki
2013-01-28 13:04 ` Lan Tianyu [this message]
2013-01-28 13:13 ` Rafael J. Wysocki
2013-01-28 13:39 ` Lan Tianyu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5106775D.1080101@gmail.com \
--to=lantianyu1986@gmail.com \
--cc=james.dutton@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=tianyu.lan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).