Re: [-mm PATCH 1/2] printk return value: fix it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Guillaume Chazarain wrote:
> What's the true meaning of the printk return value?
> Should it include the priority prefix length of 3? and what about the
> timing
> information? In both cases it was broken:
> 
> strace -e write echo 1 > /dev/kmsg
> => write(1, "1\n", 2)                      = 5
> strace -e write echo "<1>1" > /dev/kmsg
> => write(1, "<1>1\n", 5)                   = 8
This is clearly a bug, but due to (almost) no one
ever checking the return value, it has gone unnoticed.

> 
> The returned length was "length of input string + 3", I made it "length
> of string output to the log buffer".

I agree with this change.  I think it fits with how
the size is returned from printf in user space,
which can be greater than the length of the format
string when values are replaced in the string.  So
at least for printf, there is a precedent for returning a
number greater than the length of the submitted string.

 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux