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]
Date:	Tue, 9 Nov 2010 21:16:33 -0500
From:	Kristian Høgsberg <krh@...planet.net>
To:	Joe Perches <joe@...ches.com>
Cc:	linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV

On Tue, Nov 9, 2010 at 7:35 PM, Joe Perches <joe@...ches.com> wrote:
> Using %pV reduces the number of printk calls and
> eliminates any possible message interleaving from
> other printk calls.
>
> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
>  drivers/gpu/drm/drm_stub.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index cdc89ee..e632527 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -57,13 +57,21 @@ void drm_ut_debug_printk(unsigned int request_level,
>                         const char *function_name,
>                         const char *format, ...)
>  {
> +       struct va_format vaf;
>        va_list args;
>
>        if (drm_debug & request_level) {
> -               if (function_name)
> -                       printk(KERN_DEBUG "[%s:%s], ", prefix, function_name);
>                va_start(args, format);
> -               vprintk(format, args);
> +
> +               vaf.fmt = format;
> +               vaf.va = &args;
> +
> +               if (function_name)
> +                       printk(KERN_DEBUG "[%s:%s], %pV",
> +                              prefix, function_name, &vaf);
> +               else
> +                       printk(KERN_DEBUG "%pV", &vaf);

Wouldn't it be easier and more convenient to just make the %pV format
specifier just expect a format string and the va_arg list?  Like this

  printk(KERN_DEBUG "%pV", format, &args);

I mean, the %pV is kernel specific and we can just change how it works.

Kristian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ