Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2155304imm; Sat, 28 Jul 2018 10:21:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd5b+El4DPFB2NbMf2z3JWS5/wC83r5y6NF98Z8AxdB9lFmIkHFlm0L/yrnpb+RoRy5I0vX X-Received: by 2002:a63:743:: with SMTP id 64-v6mr10693382pgh.216.1532798509419; Sat, 28 Jul 2018 10:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532798509; cv=none; d=google.com; s=arc-20160816; b=Mg9FbNHHAx6eklyLA09ut7+ercQWNHk/Su1yq0PaVq1fa+U2dAhsL9XbvaFdK6PmFw FfdELDRuLVmoAGS8im9wq1KRAw13BFINiVNLTSiU+3dnlyI5f9bCCPHrqhmfwjpAHzh0 tNRL7ylcfjtk0YJ/CeK214aJuV2aygFy4zwJfsnx6XulCSIevrKabkJnICJXl+nrelbj IhZqXxarN9u1xD0csjfBCA5GoGjDVYgtKdIchcaz749TSTeU/p5f1KFYsr8Fzi8ldOdz OTo/8Mha6v/qz31qRLLC3qJQQChmXNBiv5q0z1i6RnxCpY8khrvGZs2K8PZtF9Taq2Iq Q3JQ== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=i3FLYwqtaKx1lL9kEG82NpAWFocVjbdRroHb7tLoE5Y=; b=ZnVg1vJ3d1x/9dTYm/oh5Q1+Y7vE+B9w/U3Q2cOTNzKMo4ZA13cVICMWR2MJERAaxr 9Yu2DRpNNYsmQQRLo+DBEUvhsXvNzZrG7T0lfJ7WQVjUXXD9IWZXl4Wtuj2EjeSr5I29 f4/kGavleFqA4rdlN/s38lqUeNQVJcluU8mOxH22FFsz+BoYVDDEpvhyF76Yw8MdLUMn ArE8RLC0VYdKsSFw14skFKQZrcYIZ3yLsZ+joLLqdKMZutlMP8Owoi1ZsU3jui9lD2XW AX79WWpg2sTELncxFg3A2jEf7nF8tBM3iiXsstsOD7FC99ZR5Io+2HZBx7/yinBsgMb9 ZIDg== 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 b8-v6si6085916pls.137.2018.07.28.10.21.34; Sat, 28 Jul 2018 10:21:49 -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 S1729454AbeG1Sr7 (ORCPT + 99 others); Sat, 28 Jul 2018 14:47:59 -0400 Received: from smtprelay0094.hostedemail.com ([216.40.44.94]:52498 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729206AbeG1Sr6 (ORCPT ); Sat, 28 Jul 2018 14:47:58 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id D6D44180A68A0; Sat, 28 Jul 2018 17:20:46 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2525:2553:2559:2563:2682:2685:2828:2859:2895:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6119:6120:6248:7903:8603:9025:10004:10400:10848:11232:11658:11914:12043:12296:12555:12740:12760:12895:13069:13255:13311:13357:13439:13972:14096:14097:14181:14659:14721:14777:21080:21212:21433:21627:21740:30034:30054:30070:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 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:25,LUA_SUMMARY:none X-HE-Tag: sign88_40df5778e5f13 X-Filterd-Recvd-Size: 2298 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA; Sat, 28 Jul 2018 17:20:45 +0000 (UTC) Message-ID: Subject: Re: [RFC PATCH] checkpatch: check for function calls with struct or union on stack From: Joe Perches To: Julia Lawall Cc: David Laight , 'Andrew Morton' , Andy Whitcroft , LKML Date: Sat, 28 Jul 2018 10:20:44 -0700 In-Reply-To: References: <1236369d28b2f1f5389ff652c4eb89e699e6481e.camel@perches.com> <20180726122533.104f6eea950853ef50ebc680@linux-foundation.org> <20180726122807.fad0566951e36d930edb6874@linux-foundation.org> <9d7441a14897426f8ed5befe8da0cad3@AcuMS.aculab.com> <0a6d2ecfacf3786228de664c8e01f6de10314c1b.camel@perches.com> <9f0377fa74bd4964912ba5a4fc76526d@AcuMS.aculab.com> <1a75fda0861a0b2bce208fbf9b53785bf0e76fa2.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 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 (unintentionally sent partial reply, better now) On Sat, 2018-07-28 at 08:25 +0200, Julia Lawall wrote: > On Fri, 27 Jul 2018, Joe Perches wrote: [] > > It might make sense for this sort of check to be > > added to coccinelle or maybe as a compiler warning > > when the struct is larger than some size. > > > > Original thread for Julia: > > https://lore.kernel.org/patchwork/patch/967890/ > > Coccinelle doesn't directly know the size of the structure, but it can > count the number of fields. Maybe a case with an update in the function > body Perhaps this might be the most useful to check. > or at least 3 fields is worth reporting on? Maybe, maybe not. For instance: lib/vsprintf.c uses struct printf_spec which is 5 fields totaling 8 bytes and that fits nicely in a single register on x86-64 so there are good reasons why structs could be passed by value. Maybe structs with arrays or other structs would make more sense.