aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2014-07-25 07:19:54 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-27 17:24:16 -0400
commit0a12830893e8b111189e9019848ead054b0f85b3 (patch)
tree609394e596e58ec4aa402a795acd7a0987a087a7 /drivers/media
parent9c9cb1fad865b3d9e9c4d7bbfbd20ca04cdc79b3 (diff)
[media] solo6x10: fix potential null dereference
drivers/media/pci/solo6x10/solo6x10-disp.c:221 solo_set_motion_block() error: potential null dereference 'buf'. (kzalloc returns null) Also propagate this error up the chain. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/pci/solo6x10/solo6x10-disp.c2
-rw-r--r--drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/pci/solo6x10/solo6x10-disp.c b/drivers/media/pci/solo6x10/solo6x10-disp.c
index ed88ab4455a5..5ea9cac03968 100644
--- a/drivers/media/pci/solo6x10/solo6x10-disp.c
+++ b/drivers/media/pci/solo6x10/solo6x10-disp.c
@@ -216,6 +216,8 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch,
216 int ret = 0; 216 int ret = 0;
217 217
218 buf = kzalloc(size, GFP_KERNEL); 218 buf = kzalloc(size, GFP_KERNEL);
219 if (buf == NULL)
220 return -ENOMEM;
219 for (y = 0; y < SOLO_MOTION_SZ; y++) { 221 for (y = 0; y < SOLO_MOTION_SZ; y++) {
220 for (x = 0; x < SOLO_MOTION_SZ; x++) 222 for (x = 0; x < SOLO_MOTION_SZ; x++)
221 buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + x]); 223 buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + x]);
diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
index 2e07b497a37c..28023f9f1dc7 100644
--- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
@@ -1137,11 +1137,13 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
1137 solo_enc->motion_enabled = ctrl->val > V4L2_DETECT_MD_MODE_DISABLED; 1137 solo_enc->motion_enabled = ctrl->val > V4L2_DETECT_MD_MODE_DISABLED;
1138 if (ctrl->val) { 1138 if (ctrl->val) {
1139 if (solo_enc->motion_global) 1139 if (solo_enc->motion_global)
1140 solo_set_motion_threshold(solo_dev, solo_enc->ch, 1140 err = solo_set_motion_threshold(solo_dev, solo_enc->ch,
1141 solo_enc->motion_thresh); 1141 solo_enc->motion_thresh);
1142 else 1142 else
1143 solo_set_motion_block(solo_dev, solo_enc->ch, 1143 err = solo_set_motion_block(solo_dev, solo_enc->ch,
1144 solo_enc->md_thresholds->p_cur.p_u16); 1144 solo_enc->md_thresholds->p_cur.p_u16);
1145 if (err)
1146 return err;
1145 } 1147 }
1146 solo_motion_toggle(solo_enc, ctrl->val); 1148 solo_motion_toggle(solo_enc, ctrl->val);
1147 return 0; 1149 return 0;
@@ -1152,8 +1154,7 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
1152 break; 1154 break;
1153 case V4L2_CID_OSD_TEXT: 1155 case V4L2_CID_OSD_TEXT:
1154 strcpy(solo_enc->osd_text, ctrl->p_new.p_char); 1156 strcpy(solo_enc->osd_text, ctrl->p_new.p_char);
1155 err = solo_osd_print(solo_enc); 1157 return solo_osd_print(solo_enc);
1156 return err;
1157 default: 1158 default:
1158 return -EINVAL; 1159 return -EINVAL;
1159 } 1160 }