Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751250AbbEGJBo (ORCPT ); Thu, 7 May 2015 05:01:44 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:48665 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750959AbbEGJBk (ORCPT ); Thu, 7 May 2015 05:01:40 -0400 Date: Thu, 7 May 2015 12:00:34 +0300 From: Dan Carpenter To: Geert Uytterhoeven Cc: Chris Metcalf , Linus Torvalds , Al Viro , Fabian Frederick , Randy Dunlap , Rickard Strandqvist , Greg KH , Peter Zijlstra , "David S. Miller" , Frederic Weisbecker , Andrew Morton , Sam Ravnborg , Stephen Rothwell , "Theodore Ts'o" , Grant Likely , Linux Kernel Mailing List , Linux-Arch Subject: Re: [PATCH 2/3] string: provide strscpy() and strscpy_truncate() Message-ID: <20150507090034.GV16501@mwanda> References: <1430409677-13284-1-git-send-email-cmetcalf@ezchip.com> <1430409677-13284-3-git-send-email-cmetcalf@ezchip.com> <20150506150140.GB12986@mwanda> <554A3161.3030609@ezchip.com> <20150506155951.GS16501@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1226 Lines: 31 On Wed, May 06, 2015 at 06:45:56PM +0200, Geert Uytterhoeven wrote: > On Wed, May 6, 2015 at 5:59 PM, Dan Carpenter wrote: > > We actually do have a __must_check tag so it's easy enough to force > > people to check. A different option is we could make it trigger a > > People tend to ignore compiler warnings... We're doing a lot better these days with zero day build testing. There is not even one ignored __must_check return in my allmodconfig. > > > WARN_ONCE(). > > > > #define strXcpy(dest, src, len) (({ \ > > ssize_t __ret = strscpy_truncate(dest, src, len); \ > > WARN_ONCE(__ret < 0, "strXcpy trancates\n"); \ > > __ret; })) > > Which will probably trigger only in extreme cases in the wild, not during > development. It's less subtle than just putting an empty string there so we're more likely to get bug reports than with the original code. regards, dan carpenter -- 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/