Re: [PATCH] kdump: Add udev events for memory online/offline

From: Dave Hansen
Date: Fri Oct 28 2011 - 18:57:43 EST


On Fri, 2011-10-28 at 15:41 -0700, Andrew Morton wrote:
> > + } else if (!strncmp(buf, "offline", min((int)count, 7))) {
> > ret = memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE);
> > -
> > + if (ret == 0)
> > + kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
> > + }
>
> ot: what on earth is up with that min() thing which
> Dave-who-doesn't-know-about-min_t added to the strncmp() calls?

My first reaction was, "that's not my code!", but git seems to disagree
with me. So I'll go and blame it on being young and stupid in 2005.

Reading it, I also think it's probably buggy.

echo -n "o" > state

would be interesting. I think it'll fall in to the 'online' case.
While probably not that common, it's certainly unexpected. I'll send a
patch to fix it up.

-- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/