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: <loom.20120720T160308-562@post.gmane.org>
Date:	Fri, 20 Jul 2012 14:40:46 +0000 (UTC)
From:	Betty Dall <betty.dall@...com>
To:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] checkpatch: Add checks for do {} while (0) macro misuses

Hi Joe,

Joe Perches <joe <at> perches.com> writes:

> 
> These types of macros should not be used for either a
> single statement nor should the macro end with a semi-colon.
> 
> Add tests for these conditions.
> 
> Signed-off-by: Joe Perches <joe <at> perches.com>
> ---
>  scripts/checkpatch.pl |   39 +++++++++++++++++++++++++++++++++++++++
>  1 files changed, 39 insertions(+), 0 deletions(-)


I reviewed this and tested it out on the qib.h file we were looking at yesterday 
and it worked well. I was worried about a nested do {} while(0), because it will 
match with the first while. Here is a test case:
#define qib_devinfo(pcidev, fmt, ...) \
        do { \
                do { \
                        dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__); \
                } while (0); \
        } while (0)

Checkpatch.pl didn't complain about that one. Granted, it is a contrived test 
case. Your change will catch the real problems.

-Betty



--
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