diff mbox series

media: v4l: Fix MPEG-2 slice Intra DC Precision validation

Message ID AM0PR03MB46764B5CB90B17825C56DFFFACD60@AM0PR03MB4676.eurprd03.prod.outlook.com (mailing list archive)
State New, archived
Headers show
Series media: v4l: Fix MPEG-2 slice Intra DC Precision validation | expand

Commit Message

Jonas Karlman Nov. 25, 2018, 3:21 p.m. UTC
intra_dc_precision is a 2-bit integer [1]
allow use of all valid options, 8 - 11 bits precision

[1] ISO/IEC 13818-2 Table 6-13

Fixes: c27bb30e7b6d ("media: v4l: Add definitions for MPEG-2 slice format and metadata")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>

---

 drivers/media/v4l2-core/v4l2-ctrls.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul Kocialkowski Nov. 29, 2018, 8:39 a.m. UTC | #1
Hi,

On Sun, 2018-11-25 at 15:21 +0000, Jonas Karlman wrote:
> intra_dc_precision is a 2-bit integer [1]
> allow use of all valid options, 8 - 11 bits precision
> 
> [1] ISO/IEC 13818-2 Table 6-13

Thanks for this patch, this is definitely a mistake from my side here!

> Fixes: c27bb30e7b6d ("media: v4l: Add definitions for MPEG-2 slice format and metadata")
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>

Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Cheers,

Paul

> ---
> 
>  drivers/media/v4l2-core/v4l2-ctrls.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 5f2b033a7a42..129a986fa7e1 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1636,7 +1636,8 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
>  		switch (p_mpeg2_slice_params->picture.intra_dc_precision) {
>  		case 0: /* 8 bits */
>  		case 1: /* 9 bits */
> -		case 11: /* 11 bits */
> +		case 2: /* 10 bits */
> +		case 3: /* 11 bits */
>  			break;
>  		default:
>  			return -EINVAL;
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 5f2b033a7a42..129a986fa7e1 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1636,7 +1636,8 @@  static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
 		switch (p_mpeg2_slice_params->picture.intra_dc_precision) {
 		case 0: /* 8 bits */
 		case 1: /* 9 bits */
-		case 11: /* 11 bits */
+		case 2: /* 10 bits */
+		case 3: /* 11 bits */
 			break;
 		default:
 			return -EINVAL;