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: <1159462990.5015.50.camel@localhost>
Date:	Thu, 28 Sep 2006 10:03:10 -0700
From:	Joe Perches <joe@...ches.com>
To:	Denis Vlasenko <vda.linux@...glemail.com>
Cc:	Randy Dunlap <rdunlap@...otime.net>, Greg KH <greg@...ah.com>,
	Jesper Juhl <jesper.juhl@...il.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Tiny error in printk output for clocksource : a3:<6>Time:
	acpi_pm clocksource has been installed.

On Thu, 2006-09-28 at 18:19 +0200, Denis Vlasenko wrote:
> You are trying to cover all possible cases with this monstrosity:
> extern char *__dev_addr6_fmt(char* buf, const unsigned char *addr);
> #define DEV_ADDR6_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
> #define DEV_ADDR6_BUF char __dev_addr6_buf[sizeof("FF:FF:FF:FF:FF:FF")]
> DEV_ADDR6_BUF;
> ...
> printk(", h/w address " DEV_ADDR6_FMT "\n", DEV_ADDR6(dev->dev_addr));

Yup, it's not pretty.

> Why don't you use a parameter for DEV_ADDR6{_BUF}? DEV_ADDR6_BUF(var_name).
> DEV_ADDR6(var_name, addr). That would be less cryptic.

Your idea makes code a bit visually longer, but I've no real objection.

> print_mac(", h/w address ", dev->dev_addr, "\n");

> > Would a patch with a DEV6_ADDR->EUI48 substitution
> > be acceptable?
> 
> Maybe. Doesn't look obvious, but if it is in standards...

Perhaps:

extern char *__EUI48_fmt(char *buf, const unsigned char *addr);
#define EUI48_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
#define DECLARE_EUI48(name) char name[sizeof("FF:FF:FF:FF:FF:FF")]
#define EUI48(name, addr) __EUI48_fmt(name, (const unsigned char *)addr)

use case:

{
	DECLARE_EUI48(eui48);
	printk("mac: " EUI48_FMT, EUI48(eui48, dev->dev_addr));
}

Here's one with an assumption of an eui48 buffer name.

extern char *__EUI48_fmt(char *buf, const unsigned char *addr);
#define EUI48_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
#define DECLARE_EUI48 char __eui48_buf[sizeof("FF:FF:FF:FF:FF:FF")]
#define EUI48(addr) __EUI48_fmt(__eui48_buf, (const unsigned char *)addr)

use case:

{
	DECLARE_EUI48;
	printk("mac: " EUI48_FMT, EUI48(dev->dev_addr));
}

Which one do you like more?

-
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