aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <m.chehab@samsung.com>2013-11-02 04:51:59 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-11-08 06:45:41 -0500
commit5bf30b3bc4ff80ef71a733a1f459cca4fa507892 (patch)
treeb6579a6ee87ca9fccbe72b8265847942e70d1ffa /drivers/media
parentf7a35df15b1f7de7823946aebc9164854e66ea07 (diff)
[media] av7110_hw: Don't use dynamic static allocation
Dynamic static allocation is evil, as Kernel stack is too low, and compilation complains about it on some archs: drivers/media/pci/ttpci/av7110_hw.c:510:1: warning: 'av7110_fw_cmd' uses dynamic stack allocation [enabled by default] Instead, let's enforce a limit for the buffer. In the specific case of this driver, the maximum fw command size is 6 + 2, as checked using: $ git grep -A1 av7110_fw_cmd drivers/media/pci/ttpci/ So, use 8 for the buffer size. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/pci/ttpci/av7110_hw.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/media/pci/ttpci/av7110_hw.c b/drivers/media/pci/ttpci/av7110_hw.c
index f1cbfe526989..6299d5dadb82 100644
--- a/drivers/media/pci/ttpci/av7110_hw.c
+++ b/drivers/media/pci/ttpci/av7110_hw.c
@@ -22,7 +22,7 @@
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html 23 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
24 * 24 *
25 * the project's page is at http://www.linuxtv.org/ 25 * the project's page is at http://www.linuxtv.org/
26 */ 26 */
27 27
28/* for debugging ARM communication: */ 28/* for debugging ARM communication: */
@@ -40,6 +40,14 @@
40 40
41#define _NOHANDSHAKE 41#define _NOHANDSHAKE
42 42
43/*
44 * Max transfer size done by av7110_fw_cmd()
45 *
46 * The maximum size passed to this function is 6 bytes. The buffer also
47 * uses two additional ones for type and size. So, 8 bytes is enough.
48 */
49#define MAX_XFER_SIZE 8
50
43/**************************************************************************** 51/****************************************************************************
44 * DEBI functions 52 * DEBI functions
45 ****************************************************************************/ 53 ****************************************************************************/
@@ -488,11 +496,18 @@ static int av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)
488int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...) 496int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...)
489{ 497{
490 va_list args; 498 va_list args;
491 u16 buf[num + 2]; 499 u16 buf[MAX_XFER_SIZE];
492 int i, ret; 500 int i, ret;
493 501
494// dprintk(4, "%p\n", av7110); 502// dprintk(4, "%p\n", av7110);
495 503
504 if (2 + num > sizeof(buf)) {
505 printk(KERN_WARNING
506 "%s: %s len=%d is too big!\n",
507 KBUILD_MODNAME, __func__, num);
508 return -EINVAL;
509 }
510
496 buf[0] = ((type << 8) | com); 511 buf[0] = ((type << 8) | com);
497 buf[1] = num; 512 buf[1] = num;
498 513