Fix sloppy typing in the FB area copying routines
Subsystems (3)
v2 cover Fix sloppy typing in the FB area copying routines
Here are 2 patches against the 'master' branch of Linus' 'linux.git' repo...
In {cfb|sys}_copyarea(), the local variable bits_per_line is needlessly typed as *unsigned long* -- which is a 32-bit type on the 32-bit arches and a 64-bit type on the 64-bit arches;; that variable's value is derived from the __u32 typed fb_fix_screeninfo::line_length field (multiplied by 8u) and a 32-bit *unsigned int* type should still be enough to store the # of bits per line.
Sergey Shtylyov (2):
video: fbdev: core: cfbcopyarea: fix sloppy typing
video: fbdev: core: syscopyarea: fix sloppy typing
drivers/video/fbdev/core/cfbcopyarea.c | 2 +- drivers/video/fbdev/core/syscopyarea.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.26.3
PATCH v2 1/2 video: fbdev: core: cfbcopyarea: fix sloppy typing
In cfb_copyarea(), the local variable bits_per_line is needlessly typed as *unsigned long* -- which is a 32-bit type on the 32-bit arches and a 64-bit type on the 64-bit arches; that variable's value is derived from the __u32 typed fb_fix_screeninfo::line_length field (multiplied by 8u) and a 32-bit *unsigned int* type should still be enough to store the # of bits per line.
Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
--- drivers/video/fbdev/core/cfbcopyarea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/core/cfbcopyarea.c +1 -1
@@ -382,7 +382,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) {u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;u32 height = area->height, width = area->width; -unsigned long const bits_per_line = p->fix.line_length*8u ; +unsigned int const bits_per_line = p->fix.line_length *8u ;unsigned long __iomem *base =NULL ;int bits =BITS_PER_LONG , bytes = bits >>3 ;unsigned dst_idx =0 , src_idx =0 , rev_copy =0 ;
Signature · 1 line
2.26.3
Helge Deller
maintainerRe: [PATCH v2 1/2] video: fbdev: core: cfbcopyarea: fix sloppy typing
Quoted 10 lines · Sergey Shtylyov
In
cfb_copyarea(), the local variablebits_per_lineis needlessly typed as *unsigned long* -- which is a 32-bit type on the 32-bit arches and a 64-bit type on the 64-bit arches; that variable's value is derived from the__u32typedfb_fix_screeninfo::line_lengthfield (multiplied by 8u) and a 32-bit *unsigned int* type should still be enough to store the # of bits per line.Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
Signed-off-by Sergey Shtylyov <[email protected]>
applied both patches.
Thanks!
Helge
Quoted 17 lines
--- drivers/video/fbdev/core/cfbcopyarea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/video/fbdev/core/cfbcopyarea.c +1
-1@@ -382,7 +382,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) {u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;u32 height = area->height, width = area->width; -unsigned long const bits_per_line = p->fix.line_length*8u ; +unsigned int const bits_per_line = p->fix.line_length *8u ;unsigned long __iomem *base =NULL ;int bits =BITS_PER_LONG , bytes = bits >>3 ;unsigned dst_idx =0 , src_idx =0 , rev_copy =0 ;
PATCH v2 2/2 video: fbdev: core: syscopyarea: fix sloppy typing
In reply to Sergey ShtylyovIn sys_copyarea(), the local variable bits_per_line is needlessly typed as *unsigned long* -- which is a 32-bit type on the 32-bit arches and a 64-bit type on the 64-bit arches; that variable's value is derived from the __u32 typed fb_fix_screeninfo::line_length field (multiplied by 8u) and a 32-bit *unsigned int* type should still be enough to store the # of bits per line.
Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
--- drivers/video/fbdev/core/syscopyarea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/core/syscopyarea.c +1 -1
@@ -316,7 +316,7 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area) {u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;u32 height = area->height, width = area->width; -unsigned long const bits_per_line = p->fix.line_length*8u ; +unsigned int const bits_per_line = p->fix.line_length *8u ;unsigned long *base =NULL ;int bits =BITS_PER_LONG , bytes = bits >>3 ;unsigned dst_idx =0 , src_idx =0 , rev_copy =0 ;
Signature · 1 line
2.26.3