From patchwork Thu Feb 2 14:53:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9552097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B5640604A7 for ; Thu, 2 Feb 2017 14:53:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8C0227DF9 for ; Thu, 2 Feb 2017 14:53:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CEB928477; Thu, 2 Feb 2017 14:53:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C2FC27DF9 for ; Thu, 2 Feb 2017 14:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750808AbdBBOxb (ORCPT ); Thu, 2 Feb 2017 09:53:31 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:58618 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbdBBOxa (ORCPT ); Thu, 2 Feb 2017 09:53:30 -0500 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MMKJ3-1cXwmy1SiD-0086gj; Thu, 02 Feb 2017 15:53:21 +0100 From: Arnd Bergmann To: Mike Isely , Mauro Carvalho Chehab Cc: Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] [media] pvrusb2: reduce stack usage pvr2_eeprom_analyze() Date: Thu, 2 Feb 2017 15:53:04 +0100 Message-Id: <20170202145318.3803805-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:lFwMnUnGdZWc2jBczdFKG+iwdY1LcsoBSL3d+M90lqI80PRgUpX LM4b6OyQCspiKYVUnvcIe8XtXxW7/PlNfcN10Sq2Q6WSJmY8lw9umufYC5LMISESMmy2gXU WjpxJ0c5dFZWRPr0uY1FBWYzC77ltnrK6chhOMgUs3xK8C+i5e1Oj4+WnsxmgqGvJR7A6fU LF+zHj00Q8k7iV6GuH5ZQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:7hsWZd+8ou4=:FCerKljCNjCpgGqLQcwhk1 Fus1IWn6eTzY061v6GgohmKPSkr6RYYhBVNwzGkSTdJri/6yzMDRnhklTN88qFpxQvNSfCGsZ 77JFdWRa6HutMz8biz1ZUxJji7jF7vj81c258HVZNT9SCuBXXjd0Hi0haCuSBCIWyhAnNQp6c 9HuJLQ98Azfs6ong2cO4Wr+Pj13XL6WV3rqTYj7PuZ2V9MtJoUPkbz9gI9PBlu6qlYxRxskKN E2v3u4r3ewj/qaJQRZ6ZeJ7ptUbEhZ1L+id1UtR1P8EzRhVNmwuOGV6x9jqiT9y8uLcSix6GY 0tZ4uu+iZEU5B3nfWwa6LDFeip1XK0plc77Bc+VU0mj8Free+8zp+oSJEhQSK5YHGGwIf4kc5 Ji9lTKgVR8a+VhB6e8Of7NLXPoCD3EJntg6nOorB4JtHZSWM8NT9mqJ/I/qZJYsIRltSWrFif s4/0gN5C3rd82Tyuoj21Bw+l474BF5ju/bv9fJpup4/FugDFvMpurqHAessowW0w8UBLMv/Km KZAyARP7zj0qk0behkOyBCL2sm/ZhoTc86Kf/nsaEYiPJB8sgDgyRjOOidO/G6gVcEcGGAT6W d5g9o0PhlkGB97Zb46tysR6H3pXhP0k0bvy+m6STa6dG52Ul4SzDRbVpIwvR+5glr1+L6aRQr jNcJBExXzzFazMLEw9R+FVMCdvGzOjJ2lR2/U+A5AX65xuxPplxrWtIcFF14ydhQ4SJg= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/media/usb/pvrusb2/pvrusb2-eeprom.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c b/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c index 276b17fb9aad..b8fcd9660094 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c @@ -122,15 +122,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:");