[drivers/media/pci/ngene/ngene-i2c.c:122] -> [drivers/media/pci/ngene/ngene-i2c.c:39]: (error) Null pointer dereference: out Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@xxxxxxxxxx> --- drivers/media/pci/ngene/ngene-i2c.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/ngene/ngene-i2c.c b/drivers/media/pci/ngene/ngene-i2c.c index 2e9e9774dc6f..bfdb7286f6f0 100644 --- a/drivers/media/pci/ngene/ngene-i2c.c +++ b/drivers/media/pci/ngene/ngene-i2c.c @@ -36,7 +36,10 @@ static int ngene_command_i2c_read(struct ngene *dev, u8 adr, com.cmd.hdr.Opcode = CMD_I2C_READ; com.cmd.hdr.Length = outlen + 3; com.cmd.I2CRead.Device = adr << 1; - memcpy(com.cmd.I2CRead.Data, out, outlen); + + if (out) + memcpy(com.cmd.I2CRead.Data, out, outlen); + com.cmd.I2CRead.Data[outlen] = inlen; com.cmd.I2CRead.Data[outlen + 1] = 0; com.in_len = outlen + 3; -- 2.21.0