<div dir="ltr"><div> </div><div>Hi Björn,</div><div> </div><div>I have made a patch to fix this bug.</div><div> </div><div> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 1, 2013 at 6:15 PM, Björn Brandenburg <span dir="ltr"><<a href="mailto:bbb@mpi-sws.org" target="_blank">bbb@mpi-sws.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Jun 28, 2013, at 5:52 AM, Glenn Elliott <<a href="mailto:gelliott@cs.unc.edu">gelliott@cs.unc.edu</a>> wrote:<br>
<br>
> Yes, that certainly looks like a bug. Thanks for the help!<br>
><br>
> On Jun 27, 2013, at 6:35 PM, Hiroyuki Chishiro <<a href="mailto:chishiro@cs.unc.edu">chishiro@cs.unc.edu</a>> wrote:<br>
><br>
>><br>
>> Hi Glenn,<br>
>><br>
>> I hit a bug in release_master() in "liblitmus/src/migration.c".<br>
>><br>
>> 11 int release_master()<br>
>> 12 {<br>
>> 13 static const char NO_CPU[] = "NO_CPU";<br>
>> 14 char buf[5] = {0}; /* up to 9999 CPUs */<br>
>> 15 int master = -1;<br>
>> 16<br>
>> 17 int ret = read_file("/proc/litmus/release_master", &buf, sizeof(buf)-1);<br>
>> 18<br>
>> 19 if ((ret > 0) && (strncmp(buf, NO_CPU, sizeof(NO_CPU)-1) != 0))<br>
>> 20 master = atoi(buf);<br>
>> 21<br>
>> 22 return master;<br>
>> 23 }<br>
>><br>
>><br>
>> If /proc/litmus/release_master is "NO_CPU", then buf = "NO_C" in line 17 because sizeof(buf) - 1 = 4.<br>
>> So "strncmp(buf, NO_CPU, sizeof(NO_CPU)-1) != 0" in line 19 is always true because sizeof(NO_CPU) - 1 = 6.<br>
>><br>
>> I think that the size of buf should be 7.<br>
>><br>
>> 14 char buf[7] = {0}; /* up to 999999 CPUs */<br>
>><br>
>> - Hiro<br>
>><br>
<br>
<br>
</div>Any patch to merge?<br>
<div class="HOEnZb"><div class="h5"><br>
Thanks,<br>
Björn<br>
<br>
_______________________________________________<br>
litmus-dev mailing list<br>
<a href="mailto:litmus-dev@lists.litmus-rt.org">litmus-dev@lists.litmus-rt.org</a><br>
<a href="https://lists.litmus-rt.org/listinfo/litmus-dev" target="_blank">https://lists.litmus-rt.org/listinfo/litmus-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><p style="margin:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Hiroyuki Chishiro</p><p style="margin:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
Visiting Scholar</p><p style="margin:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Department of Computer Science</p><p style="margin:0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
The University of North Carolina at Chapel Hill</p>
</div>