On Thu, Jan 14, 2016 at 3:12 AM, Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx> wrote: > What about *before* the NUL? That was the point I was trying to make. > If the string you print into the buffer isn't 'len' bytes in size the > buffer will look like, > > "DIMM location: Foo bar<garbage.....>\0" Doesn't that actually look like: "DIMM location: Foo bar\0<garbage.....>\0" snprintf() will NUL terminate what it writes into the buffer if the buffer is big enough for what you were trying to write there. The problem happens when what you want to write is too big. Then you have "DIMM location: ReallyLongFoo AlsoBar" at which point "msg[len] = '\0'; will zap that 'r' at the end to make sure printk() will stop at the end of the valid part of buffer. -Tony -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html