Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751650AbbEFQA7 (ORCPT ); Wed, 6 May 2015 12:00:59 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:41314 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750989AbbEFQAz (ORCPT ); Wed, 6 May 2015 12:00:55 -0400 Date: Wed, 6 May 2015 18:59:51 +0300 From: Dan Carpenter To: Chris Metcalf Cc: Linus Torvalds , Al Viro , Fabian Frederick , Randy Dunlap , Rickard Strandqvist , gregkh@linuxfoundation.org, Peter Zijlstra , "David S. Miller" , Frederic Weisbecker , Andrew Morton , Sam Ravnborg , Stephen Rothwell , "Theodore Ts'o" , Grant Likely , Linux Kernel Mailing List , linux-arch@vger.kernel.org Subject: Re: [PATCH 2/3] string: provide strscpy() and strscpy_truncate() Message-ID: <20150506155951.GS16501@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <554A3161.3030609@ezchip.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 667 Lines: 20 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 WARN_ONCE(). #define strXcpy(dest, src, len) (({ \ ssize_t __ret = strscpy_truncate(dest, src, len); \ WARN_ONCE(__ret < 0, "strXcpy trancates\n"); \ __ret; })) I have never really cared about truncation, though. I think not caring is the common case. 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/