Skip to contentSkip to conversation

media: ti-vpe: vpe: Return NULL for invalid buffer type

PATCH Superseded Benoit Parrot 1 participant 1 message Sep 28, 2016 Media (V4L/DVB)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 9/35 media: ti-vpe: vpe: Return NULL for invalid buffer type

From: Nikhil Devshatwar <[email protected]>

get_q_data can be called with different values for type e.g. vpe_try_crop calls it with the buffer type which gets passed from user space

Framework doesn't check wheather its correct type or not If user space passes wrong type, kernel should not crash. Return NULL when the passed type is invalid.

---
 drivers/media/platform/ti-vpe/vpe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/ti-vpe/vpe.c +1 -1
index 2a4deceea17d..b66b55322dd4 100644
@@ -420,7 +420,7 @@ static struct vpe_q_data *get_q_data(struct vpe_ctx *ctx,
 	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
 		return &ctx->q_data[Q_DATA_DST];
 	default:
-		BUG();
+		return NULL;
 	}
 	return NULL;
 }
Signature · 1 line
2.9.0