[LITMUS^RT] proposing liblitmus API additions and changes

Hiroyuki Chishiro chishiro at cs.unc.edu
Tue Jul 2 01:54:24 CEST 2013


Hi Björn,

I have made a patch to fix this bug.




On Mon, Jul 1, 2013 at 6:15 PM, Björn Brandenburg <bbb at mpi-sws.org> wrote:

> On Jun 28, 2013, at 5:52 AM, Glenn Elliott <gelliott at cs.unc.edu> wrote:
>
> > Yes, that certainly looks like a bug.  Thanks for the help!
> >
> > On Jun 27, 2013, at 6:35 PM, Hiroyuki Chishiro <chishiro at cs.unc.edu>
> wrote:
> >
> >>
> >> Hi Glenn,
> >>
> >> I hit a bug in release_master() in "liblitmus/src/migration.c".
> >>
> >>   11  int release_master()
> >>   12  {
> >>   13  static const char NO_CPU[] = "NO_CPU";
> >>   14  char buf[5] = {0}; /* up to 9999 CPUs */
> >>   15  int master = -1;
> >>   16
> >>   17  int ret = read_file("/proc/litmus/release_master", &buf,
> sizeof(buf)-1);
> >>   18
> >>   19  if ((ret > 0) && (strncmp(buf, NO_CPU, sizeof(NO_CPU)-1) != 0))
> >>   20  master = atoi(buf);
> >>   21
> >>   22  return master;
> >>   23  }
> >>
> >>
> >> If /proc/litmus/release_master is "NO_CPU", then buf = "NO_C" in line
> 17 because sizeof(buf) - 1 = 4.
> >> So "strncmp(buf, NO_CPU, sizeof(NO_CPU)-1) != 0" in line 19 is always
> true because sizeof(NO_CPU) - 1 = 6.
> >>
> >> I think that the size of buf should be 7.
> >>
> >>   14  char buf[7] = {0}; /* up to 999999 CPUs */
> >>
> >> - Hiro
> >>
>
>
> Any patch to merge?
>
> Thanks,
> Björn
>
> _______________________________________________
> litmus-dev mailing list
> litmus-dev at lists.litmus-rt.org
> https://lists.litmus-rt.org/listinfo/litmus-dev
>



-- 

Hiroyuki Chishiro

Visiting Scholar

Department of Computer Science

The University of North Carolina at Chapel Hill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litmus-rt.org/pipermail/litmus-dev/attachments/20130701/b981ddf4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: migration.patch
Type: application/octet-stream
Size: 460 bytes
Desc: not available
URL: <http://lists.litmus-rt.org/pipermail/litmus-dev/attachments/20130701/b981ddf4/attachment.obj>


More information about the litmus-dev mailing list