atafb: avoid cast when assigning buffer address pointer
Helge Deller
maintainerPATCH 1/1 atafb: avoid cast when assigning buffer address pointer
The sparse tool complains that the "cast removes the address space '__iomem' of expression".
Avoid the cast by using the screen_buffer pointer instead of the screen_base pointer from the union.
--- drivers/video/fbdev/atafb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/atafb.c +1 -1
@@ -2454,7 +2454,7 @@ static void svblit_fillrect(struct fb_info *info, ((u32 *)info->pseudo_palette)[rect->color] : rect->color;/* draw the first line with the CPU ... */ - line = (u8 *)info->screen_base + rect->dy * pitch + + line = info->screen_buffer + rect->dy * pitch + rect->dx * bytespp;switch (bytespp) {case 1 :
Signature · 1 line
2.55.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] fbdev: incorrect sparse warning suppression via union alias --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] fbdev: incorrect sparse warning suppression via union alias
--
commit d3053bb9def82e951de5b1b68d5beb85bd502468
Author: Helge Deller <[email protected]>
atafb: avoid cast when assigning buffer address pointer
This commit attempts to resolve a sparse warning about an __iomem address space cast by switching to the screen_buffer alias from the fb_info union.
drivers/video/fbdev/atafb.c static void svblit_fillrect(struct fb_info *info, · line 2458
Quoted 11 lines
drivers/video/fbdev/atafb.c +1
-1@@ -2454,7 +2454,7 @@ static void svblit_fillrect(struct fb_info *info, ((u32 *)info->pseudo_palette)[rect->color] : rect->color;/* draw the first line with the CPU ... */ - line = (u8 *)info->screen_base + rect->dy * pitch + + line = info->screen_buffer + rect->dy * pitch + rect->dx * bytespp;
[Severity: Low]
This isn't a runtime bug, but does this improperly suppress the sparse warning by type-punning through the union alias?
By switching to screen_buffer in svblit_fillrect(), the code bypasses the __iomem static analysis checks without making the memory access structurally correct.
Shouldn't this use an explicit (__force) cast or proper I/O accessors rather than hiding the access through a non-__iomem union member?
Quoted 2 lines
drivers/video/fbdev/atafb.c +0
-0switch (bytespp) {case 1 :
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1