Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp813818imm; Thu, 26 Jul 2018 12:27:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd8yKjXiKmxpWvcXC/DyWgWguGXVJm5mxEc/3ppCFhR6hWDeBE/Kna0jrP5ok9cdGeDZNGj X-Received: by 2002:a62:41d6:: with SMTP id g83-v6mr3347645pfd.219.1532633249404; Thu, 26 Jul 2018 12:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532633249; cv=none; d=google.com; s=arc-20160816; b=IaKqSJAXo0o8BAhHW+6BFpwkCVtPXkSDu7+FtwTJfodiepl86bANlFZb7xhDtQ2AG6 xSiG9NFg5Ryw/WJc5gV9oevLq6cTK36mxAKOE8btZGSGbaUBvkS/fKTUbCaVOin9mS1e vg57hNE3BRYNfM7XkWt74EgBI7sxoVtVhSbPCy9JqCdbLqdUuyE/I53qMbzYzNoVbzXE e3ImMKsYph1ucdJmzNsHF5nmgv7QSfO38ZrOt2qbqjgjlocGZu3MS9zhPjblRMcbsnAC ++UxmiCWSCU4tul68KQVowgQby2plGUFsZZMO2zWgZ1wqG8K14J93jb55WYPvypRFDzs zJNg== 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:message-id:subject:cc:to:from:date :arc-authentication-results; bh=T9B0pk0TEE/GK97vV0u6sctgI/Lo6puvhHQDC2gPY+U=; b=tqdylXVejWsSLj/55uBELn20akisF9StLiOv+8HmVZdNgkcaunI7Ys0uYTKGKNoape JT5K3QxHRAUqJKHKu/GpfURTnbPb1qIWcM6zli5yITwWNNIX/605kGYxdC11HBUSlc4U baI/gnoHcv5UAL8bsEFCvwgokhjtdGrD8CU4X4AszvAN040Ow4JttRuAfxzpbPXB1rJA GGBlYhAG0YZIwnhdmNH89Mk6ztiOII1YytKdXdvVVngS0g2U87ydt61IblzX4YVEIAHd QczIDUFZ98ZAaRTn4s7eIZns//+B0w3+XtTDYHhdDYW1EDCkaQAYafKYGdk8virKQ5lt TG5A== 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 h8-v6si1887749pgr.379.2018.07.26.12.27.14; Thu, 26 Jul 2018 12:27:29 -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 S1732112AbeGZUnu (ORCPT + 99 others); Thu, 26 Jul 2018 16:43:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36716 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732070AbeGZUnu (ORCPT ); Thu, 26 Jul 2018 16:43:50 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.92]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D0D19D08; Thu, 26 Jul 2018 19:25:34 +0000 (UTC) Date: Thu, 26 Jul 2018 12:25:33 -0700 From: Andrew Morton To: Joe Perches Cc: Andy Whitcroft , LKML Subject: Re: [RFC PATCH] checkpatch: check for function calls with struct or union on stack Message-Id: <20180726122533.104f6eea950853ef50ebc680@linux-foundation.org> In-Reply-To: <1236369d28b2f1f5389ff652c4eb89e699e6481e.camel@perches.com> References: <1236369d28b2f1f5389ff652c4eb89e699e6481e.camel@perches.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 26 Jul 2018 11:27:50 -0700 Joe Perches wrote: > I was cc'd on a patch where structs were used on stack instead > of using pointers to the structs. "passed by value" is a good term for this practice. This can cause defects when > the calling function modifies the stack struct instead of the "called" > calling function's struct. > > Possible patch below, but it may be overkill for the number of > instances > where this is actually an issue. > > Thoughts? Seems worthwhile. > There are what seems to be some false positives for a few of the > .h files in include/linux/... where the false positives are for > very small structs where the indirection via a pointer might be > slower than than the stack use. > > For instance: (some duplicates removed) I'll give it a spin, see how noisy it is.