* [PATCH] media: dvb-core: Check for allocation failure in dvb_module_probe()
@ 2018-03-28 11:46 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2018-03-28 11:46 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media, kernel-janitors
We should check if kzalloc() fails.
Fixes: 8f569c0b4e6b ("media: dvb-core: add helper functions for I2C binding")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index cf747d753a79..787fe06df217 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -953,6 +953,8 @@ struct i2c_client *dvb_module_probe(const char *module_name,
struct i2c_board_info *board_info;
board_info = kzalloc(sizeof(*board_info), GFP_KERNEL);
+ if (!board_info)
+ return NULL;
if (name)
strlcpy(board_info->type, name, I2C_NAME_SIZE);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-03-28 11:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-28 11:46 [PATCH] media: dvb-core: Check for allocation failure in dvb_module_probe() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).