Skip to content

Commit

Permalink
Merge tag 'vla-leftovers-v4.19-rc1' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/kees/linux

Pull VLA removal leftovers from Kees Cook:

 - bus/imx-weim: Use maximum register count to avoid VLA

 - drm/i2c/tda9950: Use maximum CEC message size to avoid VLA

* tag 'vla-leftovers-v4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  bus: imx-weim: Remove VLA usage
  drm/i2c: tda9950: Remove VLA usage
  • Loading branch information
torvalds committed Aug 17, 2018
2 parents f19f5c4 + d8dfa59 commit 84f5685
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion drivers/bus/imx-weim.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ static const struct imx_weim_devtype imx51_weim_devtype = {
.cs_stride = 0x18,
};

#define MAX_CS_REGS_COUNT 6

static const struct of_device_id weim_id_table[] = {
/* i.MX1/21 */
{ .compatible = "fsl,imx1-weim", .data = &imx1_weim_devtype, },
Expand Down Expand Up @@ -112,9 +114,12 @@ static int __init imx_weim_gpr_setup(struct platform_device *pdev)
static int __init weim_timing_setup(struct device_node *np, void __iomem *base,
const struct imx_weim_devtype *devtype)
{
u32 cs_idx, value[devtype->cs_regs_count];
u32 cs_idx, value[MAX_CS_REGS_COUNT];
int i, ret;

if (WARN_ON(devtype->cs_regs_count > MAX_CS_REGS_COUNT))
return -EINVAL;

/* get the CS index from this child node's "reg" property. */
ret = of_property_read_u32(np, "reg", &cs_idx);
if (ret)
Expand Down
5 changes: 4 additions & 1 deletion drivers/gpu/drm/i2c/tda9950.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ struct tda9950_priv {
static int tda9950_write_range(struct i2c_client *client, u8 addr, u8 *p, int cnt)
{
struct i2c_msg msg;
u8 buf[cnt + 1];
u8 buf[CEC_MAX_MSG_SIZE + 3];
int ret;

if (WARN_ON(cnt > sizeof(buf) - 1))
return -EINVAL;

buf[0] = addr;
memcpy(buf + 1, p, cnt);

Expand Down

0 comments on commit 84f5685

Please sign in to comment.