All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: avoid printing NULL strings
@ 2026-05-15  9:10 Arnd Bergmann
  2026-05-15 22:30 ` [PATCH] drm/radeon/evergreen_cs: Add missing NULL prefix check in surface check Vitaliy Triang3l Kuzmin
  2026-05-15 23:45 ` [PATCH] drm/radeon: avoid printing NULL strings Vitaliy Triang3l Kuzmin
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-05-15  9:10 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Dave Airlie, Jerome Glisse
  Cc: Arnd Bergmann, Chris Down, Borislav Petkov (AMD), amd-gfx,
	dri-devel, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

gcc-10 warns about some printf format strings that are used to
unconditionally print a NULL string pointer from some call
sites:

In function 'evergreen_surface_check',
    inlined from 'evergreen_cs_track_validate_stencil' at drivers/gpu/drm/radeon/evergreen_cs.c:592:6,
    inlined from 'evergreen_cs_track_check' at drivers/gpu/drm/radeon/evergreen_cs.c:995:8:
include/linux/dev_printk.h:156:24: error: '%s' directive argument is null [-Werror=format-overflow=]
  156 |  dev_printk_index_wrap(_dev_warn, KERN_WARNING, dev, dev_fmt(fmt), ##__VA_ARGS__)

This is harmless here because the kernel prints them as "(null)", but
still breaks the build when compiling with -Werror.

Pass empty strings instead to avoid these warnings.

Fixes: 285484e2d55e ("drm/radeon: add support for evergreen/ni tiling informations v11")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/radeon/evergreen_cs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index daaeae6ba141..550e8f35c7d2 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -589,7 +589,7 @@ static int evergreen_cs_track_validate_stencil(struct radeon_cs_parser *p)
 		return r;
 	}
 
-	r = evergreen_surface_check(p, &surf, NULL);
+	r = evergreen_surface_check(p, &surf, "");
 	if (r) {
 		/* old userspace doesn't compute proper depth/stencil alignment
 		 * check that alignment against a bigger byte per elements and
@@ -818,7 +818,7 @@ static int evergreen_cs_track_validate_texture(struct radeon_cs_parser *p,
 	}
 
 	/* align height */
-	evergreen_surface_check(p, &surf, NULL);
+	evergreen_surface_check(p, &surf, "");
 	surf.nby = ALIGN(surf.nby, surf.halign);
 
 	r = evergreen_surface_check(p, &surf, "texture");
@@ -881,7 +881,7 @@ static int evergreen_cs_track_validate_texture(struct radeon_cs_parser *p,
 				surf.mode = ARRAY_1D_TILED_THIN1;
 			}
 			/* recompute alignment */
-			evergreen_surface_check(p, &surf, NULL);
+			evergreen_surface_check(p, &surf, "");
 			break;
 		case ARRAY_LINEAR_GENERAL:
 		case ARRAY_LINEAR_ALIGNED:
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] drm/radeon/evergreen_cs: Add missing NULL prefix check in surface check
  2026-05-15  9:10 [PATCH] drm/radeon: avoid printing NULL strings Arnd Bergmann
@ 2026-05-15 22:30 ` Vitaliy Triang3l Kuzmin
  2026-05-15 23:45 ` [PATCH] drm/radeon: avoid printing NULL strings Vitaliy Triang3l Kuzmin
  1 sibling, 0 replies; 3+ messages in thread
From: Vitaliy Triang3l Kuzmin @ 2026-05-15 22:30 UTC (permalink / raw)
  To: amd-gfx; +Cc: Arnd Bergmann

'evergreen_surface_check' is called with a NULL warning prefix when
handling potentially recoverable issues or just to compute the alignment
requirements, and 'evergreen_surface_check' is called again in case of
failure (with the correct prefix, as opposed to NULL), therefore, the
initial check must not print a warning, because the surface may be
accepted successfully after having been corrected, however if it isn't,
the final check will print the warning anyway. The surface check
functions specific to array modes already implement this behavior, but
the 'evergreen_surface_check' function itself doesn't.

This is also supposed to fix the "'%s' directive argument is null
[-Werror=format-overflow=]" compiler warning.

Fixes: 285484e2d55e ("drm/radeon: add support for evergreen/ni tiling informations v11")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vitaliy Triang3l Kuzmin <ml@triang3l.ru>
---
  drivers/gpu/drm/radeon/evergreen_cs.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 3142ef4da7f4..9196f85db9ce 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -312,8 +312,10 @@ static int evergreen_surface_check(struct radeon_cs_parser *p,
  	case ARRAY_2D_TILED_THIN1:
  		return evergreen_surface_check_2d(p, surf, prefix);
  	default:
-		dev_warn(p->dev, "%s:%d %s invalid array mode %d\n",
-				__func__, __LINE__, prefix, surf->mode);
+		if (prefix) {
+			dev_warn(p->dev, "%s:%d %s invalid array mode %d\n",
+					__func__, __LINE__, prefix, surf->mode);
+		}
  		return -EINVAL;
  	}
  	return -EINVAL;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/radeon: avoid printing NULL strings
  2026-05-15  9:10 [PATCH] drm/radeon: avoid printing NULL strings Arnd Bergmann
  2026-05-15 22:30 ` [PATCH] drm/radeon/evergreen_cs: Add missing NULL prefix check in surface check Vitaliy Triang3l Kuzmin
@ 2026-05-15 23:45 ` Vitaliy Triang3l Kuzmin
  1 sibling, 0 replies; 3+ messages in thread
From: Vitaliy Triang3l Kuzmin @ 2026-05-15 23:45 UTC (permalink / raw)
  To: amd-gfx

Nice catch, but NAK on the proposed solution.

The NULL prefix is passed to 'evergreen_surface_check' intentionally to
disable printing the warnings, and explicitly handled, but there's one
place where the NULL check was likely forgotten.

I've proposed a patch adding it there with a detailed explanation:
https://lists.freedesktop.org/archives/amd-gfx/2026-May/144615.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-15 23:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15  9:10 [PATCH] drm/radeon: avoid printing NULL strings Arnd Bergmann
2026-05-15 22:30 ` [PATCH] drm/radeon/evergreen_cs: Add missing NULL prefix check in surface check Vitaliy Triang3l Kuzmin
2026-05-15 23:45 ` [PATCH] drm/radeon: avoid printing NULL strings Vitaliy Triang3l Kuzmin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.