Merge branch 'drm-tda9950-fixes' of git://git.armlinux.org.uk/~rmk/linux-arm into...
[sfrench/cifs-2.6.git] / drivers / gpu / drm / i2c / tda9950.c
index ccd355d0c123064dd5a34e8b002d738faeec4b93..250b5e02a314a493fd0c41477237bf44f7208225 100644 (file)
@@ -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);