media: coda: Add check for kmalloc
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Thu, 17 Nov 2022 07:02:36 +0000 (15:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:25 +0000 (13:32 +0100)
commit0209e70ad496c1fcd85c2ec70e6736fd09f95d14
tree6f595825d2eb6d6883b2d42e13c4a7f94eb23600
parent05f165ded4a7baec31b65aba88e2cd1fb9b91db2
media: coda: Add check for kmalloc

[ Upstream commit 6e5e5defdb8b0186312c2f855ace175aee6daf9b ]

As the kmalloc may return NULL pointer,
it should be better to check the return value
in order to avoid NULL poineter dereference,
same as the others.

Fixes: cb1d3a336371 ("[media] coda: add CODA7541 JPEG support")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/chips-media/coda-bit.c