staging: drm/imx: ipu-dc: signedness bug in ipu_dc_init_sync()
Subsystems (3)
PATCH 1/1 staging: drm/imx: ipu-dc: signedness bug in ipu_dc_init_sync()
"map" needs to be signed for the error handling to work. In the success case then it holds a small non-negative value.
Signed-off-by Dan Carpenter <[email protected]>
drivers/staging/imx-drm/ipu-v3/ipu-dc.c +3 -2
@@ -161,14 +161,15 @@ int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced, u32 pixel_fmt, u32 width) {struct ipu_dc_priv *priv = dc->priv; -u32 reg =0 , map; +u32 reg =0 ; +int map; dc->di =ipu_di_get_num (di); map =ipu_pixfmt_to_map (pixel_fmt);if (map <0 ) {dev_dbg (priv->dev,"IPU_DISP: No MAP\n" ); -return -EINVAL ; +return map; }if (interlaced) {
Dear Dan Carpenter,
Quoted 4 lines
"map" needs to be signed for the error handling to work. In the success case then it holds a small non-negative value.
Signed-off-by Dan Carpenter <[email protected]>
Nice catch and quick glance over the source makes it seem right
Acked-by Marek Vasut <[email protected]>
Quoted 12 lines
(quoted diff) +0
-0
b/drivers/staging/imx-drm/ipu-v3/ipu-dc.cindex 59f03f9..21bf1c8 100644drivers/staging/imx-drm/ipu-v3/ipu-dc.c +2
-1@@ -161,14 +161,15 @@ int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced, u32 pixel_fmt, u32 width) {struct ipu_dc_priv *priv = dc->priv; -u32 reg =0 , map; +u32 reg =0 ; +int map;
drivers/staging/imx-drm/ipu-v3/ipu-dc.c int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di · line 175
Quoted 10 lines
drivers/staging/imx-drm/ipu-v3/ipu-dc.c +1
-1dc->di =ipu_di_get_num (di); map =ipu_pixfmt_to_map (pixel_fmt);if (map <0 ) {dev_dbg (priv->dev,"IPU_DISP: No MAP\n" ); -return -EINVAL ; +return map; }if (interlaced) {
Best regards,
Marek Vasut
Quoted 4 lines · Dan Carpenter
"map" needs to be signed for the error handling to work. In the success case then it holds a small non-negative value.
Signed-off-by Dan Carpenter <[email protected]>
Acked-by Sascha Hauer <[email protected]>
Sascha
Quoted 24 lines
drivers/staging/imx-drm/ipu-v3/ipu-dc.c +3
-2@@ -161,14 +161,15 @@ int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced, u32 pixel_fmt, u32 width) {struct ipu_dc_priv *priv = dc->priv; -u32 reg =0 , map; +u32 reg =0 ; +int map; dc->di =ipu_di_get_num (di); map =ipu_pixfmt_to_map (pixel_fmt);if (map <0 ) {dev_dbg (priv->dev,"IPU_DISP: No MAP\n" ); -return -EINVAL ; +return map; }if (interlaced) {
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |