lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53slkiaabzxkr4npxjgc32igwnspzyohvswwhooc4nfzdjw547@q3nnf3wblgfd>
Date: Mon, 28 Oct 2024 14:47:27 -0500
From: Lucas De Marchi <lucas.demarchi@...el.com>
To: Gyeyoung Baek <gye976@...il.com>
CC: Oded Gabbay <ogabbay@...nel.org>, Thomas Hellström
	<thomas.hellstrom@...ux.intel.com>, Maarten Lankhorst
	<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
	Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
	Daniel Vetter <daniel@...ll.ch>, <intel-xe@...ts.freedesktop.org>,
	<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/xe: Fix build error for XE_IOCTL_DBG macro

On Sun, Oct 27, 2024 at 01:57:52PM +0900, Gyeyoung Baek wrote:
>In the previous code, there is build error.
>if CONFIG_DRM_USE_DYNAMIC_DEBUG is set,
>'drm_dbg' function is replaced with '__dynamic_func_call_cls',
>which is replaced with a do while statement.
>
>The problem is that,
>XE_IOCTL_DBG uses this function for conditional expression.
>
>so I fix the expression to be compatible with the do while statement,
>by referring to "https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html".
>
>Signed-off-by: Gyeyoung Baek <gye976@...il.com>
>---
> drivers/gpu/drm/xe/xe_macros.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_macros.h b/drivers/gpu/drm/xe/xe_macros.h
>index daf56c846d03..58a9d1e33502 100644
>--- a/drivers/gpu/drm/xe/xe_macros.h
>+++ b/drivers/gpu/drm/xe/xe_macros.h
>@@ -11,8 +11,8 @@
> #define XE_WARN_ON WARN_ON
>
> #define XE_IOCTL_DBG(xe, cond) \
>-	((cond) && (drm_dbg(&(xe)->drm, \
>-			    "Ioctl argument check failed at %s:%d: %s", \
>-			    __FILE__, __LINE__, #cond), 1))
>+	({drm_dbg(&(xe)->drm, \
>+		"Ioctl argument check failed at %s:%d: %s", \
>+		__FILE__, __LINE__, #cond); (cond); })

but this would print the debug message regardless of the cond being
true. Previously this would enter the condition if cond && 1 (due to the
comma operator use), but printing the message was shortcut when cond was
false.

It looks like keeping cond outside and the statement expr to cover only
the call to drm_dbg would work.

Lucas De Marchi

> #endif
>-- 
>2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ