OSDN Git Service

Merge branch 'drm-tda9950-fixes' of git://git.armlinux.org.uk/~rmk/linux-arm into...
[android-x86/kernel.git] / drivers / gpu / drm / i2c / tda9950.c
index ccd355d..250b5e0 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);