Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715193

[PATCH 3.2 02/59] [media] pvrusb2: reduce stack usage pvr2_eeprom_analyze()

From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.kernel
Subject [PATCH 3.2 02/59] [media] pvrusb2: reduce stack usage pvr2_eeprom_analyze()
Date 2017-08-18 16:30 +0200
Message-ID <ufQrG-4YI-53@gated-at.bofh.it> (permalink)
References <ufPlU-4d0-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.2.92-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/media/video/pvrusb2/pvrusb2-eeprom.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

--- a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
@@ -123,15 +123,10 @@ int pvr2_eeprom_analyze(struct pvr2_hdw
 	memset(&tvdata,0,sizeof(tvdata));
 
 	eeprom = pvr2_eeprom_fetch(hdw);
-	if (!eeprom) return -EINVAL;
+	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);
-	}
+	tveeprom_hauppauge_analog(NULL, &tvdata, eeprom);
 
 	trace_eeprom("eeprom assumed v4l tveeprom module");
 	trace_eeprom("eeprom direct call results:");

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.2 00/59] 3.2.92-rc1 review Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 35/59] [media] dw2102: limit messages to buffer size Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 24/59] PCI: Fix pci_mmap_fits() for HAVE_PCI_RESOURCE_TO_USER  platforms Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 17/59] [media] gspca: konica: add missing endpoint  sanity check Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 13/59] [media] mceusb: fix NULL-deref at probe Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 20/59] [media] cx231xx-cards: fix NULL-deref at probe Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 32/59] [media] ttusb2: limit messages to buffer size Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 02/59] [media] pvrusb2: reduce stack usage  pvr2_eeprom_analyze() Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 22/59] [media] cx231xx-audio: fix NULL-deref at probe Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 04/59] ath9k_htc: Add PID/VID for a Ubiquiti WiFiStation Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 10/59] zd1211rw: fix NULL-deref at probe Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 27/59] PCI: Ignore write combining when mapping I/O  port space Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 06/59] ath9k_htc: Add new USB ID Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 25/59] [media] digitv: limit messages to buffer size Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  [PATCH 3.2 18/59] [media] usbvision: fix NULL-deref at probe Ben Hutchings <ben@decadent.org.uk> - 2017-08-18 16:30 +0200
  Re: [PATCH 3.2 00/59] 3.2.92-rc1 review Guenter Roeck <linux@roeck-us.net> - 2017-08-18 17:00 +0200

csiph-web