Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9220753ybi; Wed, 24 Jul 2019 00:13:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgfl76ekLsugqOy3YLtnd8DNk69Ov9XRdhu6LSoPqWNdcUKDbXEuz6DlXxSIb6a6SUzSrj X-Received: by 2002:a17:902:830c:: with SMTP id bd12mr86188888plb.237.1563952382096; Wed, 24 Jul 2019 00:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563952382; cv=none; d=google.com; s=arc-20160816; b=wR6b3qKXWg9SoPgyEaDDm8tslag08gcJZjf3zrlU8KsRKHIRlSzRgBBlrf9JwxTnfc MFGgkOn+4k9DDz4pOs+kbUrC0oF/YW4Td3MYQPvpKwu2o9qzuVTj9vKBJigxklntHQaN RqWxc52qBJsi0J4YtflMQOw6qRfv+8w36C8zkVqvRvPI9m5BtneHR1wmXlliPum1kVU0 3USm/WQQqGCK4NhV+ilI404mYvNmphUG0hh+L8x36yKwvSoM+eg/JjYZpbAp05Z/YBLH kj1vhQZqPGaViJYi7TB8f1gwfX1rHWjmrjdTDz64R3HW9h1dxfWulYC3wPCN3f0g3Icv dQKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=mgCP3K3CYGdzz2Tn+wLbGADFTcmuNRwkETAN62V54dM=; b=niYfHIwot/8ML+8ood0kaXJiJX20Am306CGp1wzbFb1AOoihTzDU1Qh/KxIbgwiqZW D4OViZSXm6SFWV8D97Euv811Y2xgUZjRtBPceDAF8RRo/+f4Krm+JRKoGXOboEfjwnat BJ7PoRv49ggWydcljGviUEFYQQXZYw2s+BpVfjLekmMG2XLUNMahwcXMuqOCnAQNb+1E YBKJKQVtoxHO4LqMJHmKfS50gsG0eK7qubBSSGoY1Tf3/BigeqJRLMuSN/OzbxMrZOyg J3cA5Opvg1raNyZ9iMH4wZZPkxh4e1+xldSlyUNepzQXHzxOMgll62eAqUtUWe0q0DcW Kn6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z24si15541794plo.159.2019.07.24.00.12.47; Wed, 24 Jul 2019 00:13:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726390AbfGXHLD (ORCPT + 99 others); Wed, 24 Jul 2019 03:11:03 -0400 Received: from smtprelay0241.hostedemail.com ([216.40.44.241]:33830 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725944AbfGXHLD (ORCPT ); Wed, 24 Jul 2019 03:11:03 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 13EEA182CF673; Wed, 24 Jul 2019 07:11:02 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::,RULES_HIT:41:355:379:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1537:1560:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:2914:3138:3139:3140:3141:3142:3622:3865:3867:3871:4321:5007:10004:10400:10848:11026:11232:11473:11658:11914:12297:12740:12760:12895:13069:13161:13229:13311:13357:13439:14659:14721:21080:21627:30054:30091,0,RBL:23.242.196.136:@perches.com:.lbl8.mailshell.net-62.8.0.180 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: sail18_25ca87690f746 X-Filterd-Recvd-Size: 1645 Received: from XPS-9350 (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf20.hostedemail.com (Postfix) with ESMTPA; Wed, 24 Jul 2019 07:10:59 +0000 (UTC) Message-ID: <023c0194641abe411c2338e4eed9eec876888e48.camel@perches.com> Subject: Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms From: Joe Perches To: Rasmus Villemoes , Linus Torvalds , linux-kernel@vger.kernel.org Cc: Jonathan Corbet , Stephen Kitt , Kees Cook , Nitin Gote , jannh@google.com, kernel-hardening@lists.openwall.com, Andrew Morton Date: Wed, 24 Jul 2019 00:10:58 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.5-0ubuntu0.18.10.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-07-24 at 08:53 +0200, Rasmus Villemoes wrote: > BUILD_BUG_ON(!__same_type()) > strscpy(dst, src, ARRAY_SIZE(dst)) Doing this without the temporary is less legible to read the compiler error when someone improperly does: char *foo; char *bar; stracpy(foo, bar);