From: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: Ryota Ozaki <ozaki.ryota@gmail.com>,
linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>,
linux-mm@kvack.org, stable@kernel.org
Subject: Re: [PATCH][RESEND] mm: Fix off-by-one bug in print_nodes_state
Date: Sun, 18 Dec 2011 17:48:32 -0500 [thread overview]
Message-ID: <4EEE6DC0.2030007@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1112181439500.1364@chino.kir.corp.google.com>
(12/18/11 5:44 PM), David Rientjes wrote:
> On Sun, 18 Dec 2011, Ryota Ozaki wrote:
>
>> /sys/devices/system/node/{online,possible} involve a garbage byte
>> because print_nodes_state returns content size + 1. To fix the bug,
>> the patch changes the use of cpuset_sprintf_cpulist to follow the
>> use at other places, which is clearer and safer.
>>
>
> It's not a garbage byte, sysdev files use a buffer created with
> get_zeroed_page(), so extra byte is guaranteed to be zero since
> nodelist_scnprintf() won't write to it. So the issue here is that
> print_nodes_state() returns a size that is off by one according to
> ISO C99 although it won't cause a problem in practice.
>
>> This bug was introduced since v2.6.24.
>>
>
> It's not a bug, the result of a 4-node system would be "0-3\n\0" and
> returns 5 correctly. You can verify this very simply with strace.
Usually, /sys files don't output trailing 'JPY0'. And, 'JPY0' is not regular
io friendly. So I can imagine some careless programmer think it is
garbage. Is there any benefit to show trailing 'JPY0'?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: Ryota Ozaki <ozaki.ryota@gmail.com>,
linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>,
linux-mm@kvack.org, stable@kernel.org
Subject: Re: [PATCH][RESEND] mm: Fix off-by-one bug in print_nodes_state
Date: Sun, 18 Dec 2011 17:48:32 -0500 [thread overview]
Message-ID: <4EEE6DC0.2030007@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1112181439500.1364@chino.kir.corp.google.com>
(12/18/11 5:44 PM), David Rientjes wrote:
> On Sun, 18 Dec 2011, Ryota Ozaki wrote:
>
>> /sys/devices/system/node/{online,possible} involve a garbage byte
>> because print_nodes_state returns content size + 1. To fix the bug,
>> the patch changes the use of cpuset_sprintf_cpulist to follow the
>> use at other places, which is clearer and safer.
>>
>
> It's not a garbage byte, sysdev files use a buffer created with
> get_zeroed_page(), so extra byte is guaranteed to be zero since
> nodelist_scnprintf() won't write to it. So the issue here is that
> print_nodes_state() returns a size that is off by one according to
> ISO C99 although it won't cause a problem in practice.
>
>> This bug was introduced since v2.6.24.
>>
>
> It's not a bug, the result of a 4-node system would be "0-3\n\0" and
> returns 5 correctly. You can verify this very simply with strace.
Usually, /sys files don't output trailing '¥0'. And, '¥0' is not regular
io friendly. So I can imagine some careless programmer think it is
garbage. Is there any benefit to show trailing '¥0'?
next prev parent reply other threads:[~2011-12-18 22:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 11:58 [PATCH][RESEND] mm: Fix off-by-one bug in print_nodes_state Ryota Ozaki
2011-12-18 11:58 ` Ryota Ozaki
2011-12-18 21:28 ` KOSAKI Motohiro
2011-12-18 21:28 ` KOSAKI Motohiro
2011-12-20 4:22 ` Ryota Ozaki
2011-12-20 4:22 ` Ryota Ozaki
2011-12-18 22:44 ` David Rientjes
2011-12-18 22:44 ` David Rientjes
2011-12-18 22:48 ` KOSAKI Motohiro [this message]
2011-12-18 22:48 ` KOSAKI Motohiro
2011-12-19 20:53 ` David Rientjes
2011-12-19 20:53 ` David Rientjes
2011-12-19 21:15 ` KOSAKI Motohiro
2011-12-19 21:15 ` KOSAKI Motohiro
2011-12-20 4:43 ` Ryota Ozaki
2011-12-20 4:43 ` Ryota Ozaki
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=4EEE6DC0.2030007@gmail.com \
--to=kosaki.motohiro@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ozaki.ryota@gmail.com \
--cc=rientjes@google.com \
--cc=stable@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.