Messages in this thread | | | Subject | Re: decode GFP flags in oom killer output. | Date | Thu, 08 Mar 2012 01:18:12 +0100 | From | "Michal Nazarewicz" <> |
| |
On Thu, 08 Mar 2012 01:04:21 +0100, Joe Perches <joe@perches.com> wrote:
> On Wed, 2012-03-07 at 18:39 -0500, Dave Jones wrote: >> +static void decode_gfp_mask(gfp_t gfp_mask, char *out_string) >> +{ >> + unsigned int i; >> + >> + for (i = 0; i < 32; i++) { > > < sizeof(gfp_t * 8) > >> + if (gfp_mask & (1 << i)) { > > (gfp_t)1 << i > >> + if (gfp_flag_texts[i]) >> + out_string += sprintf(out_string, "%s ", gfp_flag_texts[i]); >> + else >> + out_string += sprintf(out_string, "reserved! "); > > not much use to exclamation points. > >> + } >> + } >> + out_string = "\0"; > > out_string[-1] = 0;
Will break if gfp_mask == 0.
>> +} >> +
-- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |