Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1215587

Re: [PATCH v2 net-next 1/2] lib: introduce strncpy_from_unsafe()

From Alexei Starovoitov <ast@plumgrid.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 net-next 1/2] lib: introduce strncpy_from_unsafe()
Date 2015-08-29 00:10 +0200
Message-ID <q2A0q-7MI-17@gated-at.bofh.it> (permalink)
References <q2xYC-4IA-3@gated-at.bofh.it> <q2xYC-4IA-7@gated-at.bofh.it> <q2zH4-7az-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 8/28/15 2:48 PM, Steven Rostedt wrote:
>>   * On success, returns the length of the string (not including the trailing
>> >+ * NUL).
> I think it includes the NUL.

oops. yes. that was a copy paste from strncpy_from_user comment.
trace_kprobe usage wants NUL to be counted, so I intended to have it
counted, but that brings the question what should be the semantics.
Should it be similar to strncpy_from_user (not counting NUL) or
similar to strlen_user (counts NUL) ?
imo counting NUL makes a little bit more sense, since when a user says
strncpy_from_unsafe(..., ..., 32)
and it returns 32 as the whole buffer was filled, it looks cleaner.
Thoughts?


--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 net-next 0/2] support for '%s' in bpf_trace_printk Alexei Starovoitov <ast@plumgrid.com> - 2015-08-28 22:00 +0200
  [PATCH v2 net-next 1/2] lib: introduce strncpy_from_unsafe() Alexei Starovoitov <ast@plumgrid.com> - 2015-08-28 22:00 +0200
    Re: [PATCH v2 net-next 1/2] lib: introduce strncpy_from_unsafe() Steven Rostedt <rostedt@goodmis.org> - 2015-08-28 23:50 +0200
      Re: [PATCH v2 net-next 1/2] lib: introduce strncpy_from_unsafe() Alexei Starovoitov <ast@plumgrid.com> - 2015-08-29 00:10 +0200
        Re: [PATCH v2 net-next 1/2] lib: introduce strncpy_from_unsafe() Alexei Starovoitov <ast@plumgrid.com> - 2015-08-29 00:20 +0200
        Re: [PATCH v2 net-next 1/2] lib: introduce strncpy_from_unsafe() Steven Rostedt <rostedt@goodmis.org> - 2015-08-29 00:20 +0200

csiph-web