Re: [PATCH v2 01/25] NFSD: Fix TP_printk() format specifier in trace_nfsd_dirent()

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

 



> On May 13, 2021, at 11:10 AM, Chuck Lever III <chuck.lever@xxxxxxxxxx> wrote:
> 
>> On May 13, 2021, at 10:50 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>> 
>> On Wed, 12 May 2021 16:52:05 +0000
>> Chuck Lever III <chuck.lever@xxxxxxxxxx> wrote:
>> 
>>> The underlying need is to support non-NUL-terminated C strings.
>>> 
>>> I assumed that since the commentary around 9a6944fee68e claims
>>> the proper way to trace C strings is to use __string and friends,
>>> and those do not support non-NUL-terminated strings, that such
>>> strings are really not first-class citizens. Thus I concluded
>>> that my use of '%.*s' was incorrect.
>>> 
>>> Having some __string-style helpers that can deal with such
>>> strings would be valuable.
>> 
>> I guess the best I can do is a strncpy version, that will add the '\0' in
>> the ring buffer. That way we don't need to save the length as well (length
>> would need to be at least 4 bytes, where as '\0' is one).
>> 
>> Something like this?
>> 
>> I added "__string_len()" and "__assign_str_len()". You use them just like
>> __string() and __assign_str() but add a max length that you want to use
>> (although, it will always allocate "len" regardless if the string is
>> smaller). Then use __get_str() just like you use __string().
>> 
>> Would something like that work?
> 
> I will test later today and let you know in this thread.

All good.

Tested-by: Chuck Lever <chuck.lever@xxxxxxxxxx>


--
Chuck Lever







[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux