]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/media-saa7146-avoid-high-stack-usage-with-clang.patch
drop drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch from 4.4.y and 4.9.y
[thirdparty/kernel/stable-queue.git] / queue-4.4 / media-saa7146-avoid-high-stack-usage-with-clang.patch
1 From 071d906f242d00d0932a8cc2a1b2d6a1676b776e Mon Sep 17 00:00:00 2001
2 From: Arnd Bergmann <arnd@arndb.de>
3 Date: Tue, 19 Feb 2019 12:01:56 -0500
4 Subject: media: saa7146: avoid high stack usage with clang
5
6 [ Upstream commit 03aa4f191a36f33fce015387f84efa0eee94408e ]
7
8 Two saa7146/hexium files contain a construct that causes a warning
9 when built with clang:
10
11 drivers/media/pci/saa7146/hexium_orion.c:210:12: error: stack frame size of 2272 bytes in function 'hexium_probe'
12 [-Werror,-Wframe-larger-than=]
13 static int hexium_probe(struct saa7146_dev *dev)
14 ^
15 drivers/media/pci/saa7146/hexium_gemini.c:257:12: error: stack frame size of 2304 bytes in function 'hexium_attach'
16 [-Werror,-Wframe-larger-than=]
17 static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
18 ^
19
20 This one happens regardless of KASAN, and the problem is that a
21 constructor to initialize a dynamically allocated structure leads
22 to a copy of that structure on the stack, whereas gcc initializes
23 it in place.
24
25 Link: https://bugs.llvm.org/show_bug.cgi?id=40776
26
27 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
28 Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
29 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
30 [hverkuil-cisco@xs4all.nl: fix checkpatch warnings]
31 Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
32 Signed-off-by: Sasha Levin <sashal@kernel.org>
33 ---
34 drivers/media/pci/saa7146/hexium_gemini.c | 5 ++---
35 drivers/media/pci/saa7146/hexium_orion.c | 5 ++---
36 2 files changed, 4 insertions(+), 6 deletions(-)
37
38 diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c
39 index 03cbcd2095c6e..d4b3ce8282856 100644
40 --- a/drivers/media/pci/saa7146/hexium_gemini.c
41 +++ b/drivers/media/pci/saa7146/hexium_gemini.c
42 @@ -270,9 +270,8 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
43 /* enable i2c-port pins */
44 saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
45
46 - hexium->i2c_adapter = (struct i2c_adapter) {
47 - .name = "hexium gemini",
48 - };
49 + strscpy(hexium->i2c_adapter.name, "hexium gemini",
50 + sizeof(hexium->i2c_adapter.name));
51 saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
52 if (i2c_add_adapter(&hexium->i2c_adapter) < 0) {
53 DEB_S("cannot register i2c-device. skipping.\n");
54 diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c
55 index 15f0d66ff78a2..214396b1ca73c 100644
56 --- a/drivers/media/pci/saa7146/hexium_orion.c
57 +++ b/drivers/media/pci/saa7146/hexium_orion.c
58 @@ -232,9 +232,8 @@ static int hexium_probe(struct saa7146_dev *dev)
59 saa7146_write(dev, DD1_STREAM_B, 0x00000000);
60 saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
61
62 - hexium->i2c_adapter = (struct i2c_adapter) {
63 - .name = "hexium orion",
64 - };
65 + strscpy(hexium->i2c_adapter.name, "hexium orion",
66 + sizeof(hexium->i2c_adapter.name));
67 saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
68 if (i2c_add_adapter(&hexium->i2c_adapter) < 0) {
69 DEB_S("cannot register i2c-device. skipping.\n");
70 --
71 2.20.1
72