From patchwork Wed Nov 1 21:26:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 117738 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1259249edm; Wed, 1 Nov 2017 14:40:31 -0700 (PDT) X-Google-Smtp-Source: ABhQp+ThgxIHjcSvWyDeTJM8JVbHxwJFEEs5hhrxKINSsYlTqn5cSKlMHO/gSmQLDRjChFsw5LD8 X-Received: by 10.84.133.163 with SMTP id f32mr939083plf.385.1509572431543; Wed, 01 Nov 2017 14:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509572431; cv=none; d=google.com; s=arc-20160816; b=q+i+lB1wtokxTXylglBOV03jEZHjGzljobXYOkrUpC3+Iv5Md4fCJ4umoiK+XkJHcb BX43K0qYwyeyojaamHefwSoR9LlU5mSHLM4zrTrtWo3GKC4iDgENLS/s89lxpBCbG4It BL/nLaOGrkZyvsrvkhnkSz6+7vv4SMAd3dfGG75kr/QhqqrBZfTSS4y60H28AcM1ol+y cToSueAjprKYztO/ApvahR4SFSl6PcjeS8D4zHOmMXMdvbhbzpPGdxUB32EwawlXjwdB c9cFvpqMSdUOyXIm4TK6DV66qff+liZkf5mtFFnFTf7AWepTPqE/SJODlGldZ81UvP+V AVsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=X/lwWwH8/NkzpPCyrULc8XMuzzJz1iLjq7K4pVWzer0=; b=Mfj3Eqiry1UzjAJ9Y46vMzU/qzdhgRUJn+hwylWzObLzn8Vlh6Q9F4dpE71c8TeUP3 5hLBFpRmHzYoykdVzqo6DybtsP/EOHKiQHztVIPkXrslA8vQQzN/iNddoABlMrtK/1V3 B5FBpuTX4cg2RjHDoep59IZp08GUNbO4Weco+jl6qbwcljc5uZuAAZC71ei2LkG+TvIG FYOyzGToog2BRsjkMrq19Art0/8qTQ+cZoGfWaw+5O4S87MiXl+XfwpjgkC6Y1LTxBrW wR0nfT4uPrR+YEgPGIbcjm+7ehMhrSlcnzXrihh/a5lTSD/VZgZGt0sMh3XR5w/bgPEG EmNg== 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 d7si2025094pgf.4.2017.11.01.14.40.31; Wed, 01 Nov 2017 14:40:31 -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 S934399AbdKAVk3 (ORCPT + 26 others); Wed, 1 Nov 2017 17:40:29 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:35444 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934348AbdKAV3C (ORCPT ); Wed, 1 Nov 2017 17:29:02 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id vA1LQrFI004998; Wed, 1 Nov 2017 22:26:53 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Arnd Bergmann , Hans Verkuil , Mauro Carvalho Chehab , Willy Tarreau Subject: [PATCH 3.10 098/139] [media] pvrusb2: reduce stack usage pvr2_eeprom_analyze() Date: Wed, 1 Nov 2017 22:26:39 +0100 Message-Id: <1509571600-4858-49-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1509571600-4858-1-git-send-email-w@1wt.eu> References: <1509571159-4405-1-git-send-email-w@1wt.eu> <1509571600-4858-1-git-send-email-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 6830733d53a4517588e56227b9c8538633f0c496 upstream. The driver uses a relatively large data structure on the stack, which showed up on my radar as we get a warning with the "latent entropy" GCC plugin: drivers/media/usb/pvrusb2/pvrusb2-eeprom.c:153:1: error: the frame size of 1376 bytes is larger than 1152 bytes [-Werror=frame-larger-than=] The warning is usually hidden as we raise the warning limit to 2048 when the plugin is enabled, but I'd like to lower that again in the future, and making this function smaller helps to do that without build regressions. Further analysis shows that putting an 'i2c_client' structure on the stack is not really supported, as the embedded 'struct device' is not initialized here, and we are only saved by the fact that the function that is called here does not use the pointer at all. Fixes: d855497edbfb ("V4L/DVB (4228a): pvrusb2 to kernel 2.6.18") Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Willy Tarreau --- drivers/media/usb/pvrusb2/pvrusb2-eeprom.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) -- 2.8.0.rc2.1.gbe9624a diff --git a/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c b/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c index 9515f3a..122815e 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c @@ -123,15 +123,10 @@ int pvr2_eeprom_analyze(struct pvr2_hdw *hdw) memset(&tvdata,0,sizeof(tvdata)); eeprom = pvr2_eeprom_fetch(hdw); - if (!eeprom) return -EINVAL; - - { - struct i2c_client fake_client; - /* Newer version expects a useless client interface */ - fake_client.addr = hdw->eeprom_addr; - fake_client.adapter = &hdw->i2c_adap; - tveeprom_hauppauge_analog(&fake_client,&tvdata,eeprom); - } + if (!eeprom) + return -EINVAL; + + tveeprom_hauppauge_analog(NULL, &tvdata, eeprom); trace_eeprom("eeprom assumed v4l tveeprom module"); trace_eeprom("eeprom direct call results:");