Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2151115imm; Sat, 28 Jul 2018 10:16:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcEEG3HuRqRBBn/eawgPd/H4y3mAt+mVUSZqPlJ4olSxT36mB7HsxBP0CWkmaHnRKhbK3Va X-Received: by 2002:a17:902:7898:: with SMTP id q24-v6mr10100383pll.222.1532798187791; Sat, 28 Jul 2018 10:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532798187; cv=none; d=google.com; s=arc-20160816; b=v4qpUn7yo/oeki15HQoBBjvm40YaSrCLlLy3tZxsHHq9QqtS0eiXTgGN/OWGlfGaVZ UxKZODIs1mGo/zW7VM0aom+O+2woPdWSxKR1MSVSu4EnX/pSfRMOkumoEs3Hgwpy2hxx LZEAeAMA8Ov5KmZQOvlPKOUKjO6/t6fYKjIejXRp1czfacdepVaSAKF5LGCygqPTJN+b wwqdwZMYvaPbYqkqHg0jEUqV+HZy+lmQJ0q/IJwzLYiluGG5gjya/osqMicsHj+fU8op Gb/40m/q1lnM8+JQ6IFD446lSdmOwVJbKBkFsVOZbesxXUD3o9vxqqPCiWF0m3CYrGr1 qGAA== 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=1OaxtgSAG2w1zsd2qiasfLjEMIe2hOMAzqoARfMPtk0=; b=N9dr/AfwnuCj0FWvUyqhM6di27cjYKlbFMEXh7tyL64m9DjW12OhWO3tEqQnfylUdw sGSV6qlVbnX/vsfyjqLdVOT/r6dSn1B5W97Wq4wkf+ak2tDqx+b5L8r0Hjuo9qhWfe7J 1ouyu5NH9wvAivUyC9jk9yso5EMI4RkvmYuBRIFJwxs8oHs49cZZv+slWSXgJFynmdIb ceE9i3bPSQX7wjj38bAjKDbc/gHkt+Ae9NTQ4LqCtd1yZUd+gdeLyDN4m0GQjW/hVW6O tLgrS6D9yySeZYJuejC85VoLhhKNNEp2VKWh3UNrLe9d/4br6Z9ZqIatZwvV+ztXkbzF f5rw== 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 t8-v6si5716079plo.77.2018.07.28.10.16.00; Sat, 28 Jul 2018 10:16:27 -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 S1729392AbeG1Sls (ORCPT + 99 others); Sat, 28 Jul 2018 14:41:48 -0400 Received: from smtprelay0149.hostedemail.com ([216.40.44.149]:40177 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729365AbeG1Sls (ORCPT ); Sat, 28 Jul 2018 14:41:48 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 71522181D3368; Sat, 28 Jul 2018 17:14:37 +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:3622:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6120:8603:9025:10004:10400:10848:11232:11658:11914:12043:12296:12555:12679:12740:12760:12895:13069:13255:13311:13357:13439:14181:14659:14721:21080:21212: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:32,LUA_SUMMARY:none X-HE-Tag: fang12_b1f530d3be53 X-Filterd-Recvd-Size: 2163 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf12.hostedemail.com (Postfix) with ESMTPA; Sat, 28 Jul 2018 17:14:36 +0000 (UTC) Message-ID: <6439210644b66a1847e6fad9205fcc7056319de1.camel@perches.com> 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:14:34 -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 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? a struct with 3 chars or bools might be faster by value, but maybe for structs with arrays or other structs. For instance: lib/vsprintf.c uses struct printf_spec which is 16 bytes and that fits nicely in a