Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753017AbbH1WLq (ORCPT ); Fri, 28 Aug 2015 18:11:46 -0400 Received: from smtprelay0252.hostedemail.com ([216.40.44.252]:33395 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752695AbbH1WLo (ORCPT ); Fri, 28 Aug 2015 18:11:44 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3872:3874:4250:5007:6261:7875:10004:10400:10848:10967:11026:11232:11658:11914:12114:12296:12517:12519:12740:13069:13161:13229:13311:13357:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: dogs37_835c615b83647 X-Filterd-Recvd-Size: 2144 Date: Fri, 28 Aug 2015 18:11:41 -0400 From: Steven Rostedt To: Alexei Starovoitov Cc: "David S. Miller" , Ingo Molnar , Masami Hiramatsu , Wang Nan , He Kuang , Daniel Borkmann , Brendan Gregg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 net-next 1/2] lib: introduce strncpy_from_unsafe() Message-ID: <20150828181141.6d974130@gandalf.local.home> In-Reply-To: <55E0DBE3.8010504@plumgrid.com> References: <1440791509-5450-1-git-send-email-ast@plumgrid.com> <1440791509-5450-2-git-send-email-ast@plumgrid.com> <20150828174813.23e6e78b@gandalf.local.home> <55E0DBE3.8010504@plumgrid.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1138 Lines: 28 On Fri, 28 Aug 2015 15:08:35 -0700 Alexei Starovoitov wrote: > 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? > I personally prefer counting the NUL. I've had issues in the past with the strncpy_from_user() not counting it :-p -- Steve -- 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/