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: <51A4F3E9.4090108@cogentembedded.com>
Date:	Tue, 28 May 2013 22:14:01 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-usb@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net/usb/kalmia: use %*phC to dump small buffers

Hello.

On 28-05-2013 13:56, Andy Shevchenko wrote:

> Instead of dereferencing pointer and put values on stack we could use nice
> %*phC specifier.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>   drivers/net/usb/kalmia.c | 46 ++++++++++++++++------------------------------
>   1 file changed, 16 insertions(+), 30 deletions(-)

> diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c
> index 0192073..13ecfc5 100644
> --- a/drivers/net/usb/kalmia.c
> +++ b/drivers/net/usb/kalmia.c
[...]
> @@ -263,32 +260,24 @@ kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
>   				sizeof(EXPECTED_UNKNOWN_HEADER_1)) || !memcmp(
>   				header_start, EXPECTED_UNKNOWN_HEADER_2,
>   				sizeof(EXPECTED_UNKNOWN_HEADER_2))) {
> -				netdev_dbg(
> -					dev->net,
> -					"Received expected unknown frame header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n",
> -					header_start[0], header_start[1],
> -					header_start[2], header_start[3],
> -					header_start[4], header_start[5],
> +				netdev_dbg(dev->net,
> +					"Received expected unknown frame "
> +					"header: %6phC. Package length: %i\n",

    Message strings shouldn't be broken, despite 80 chars limit (there's an
exception for them in checkpatch.pl).

> +					header_start,
>   					skb->len - KALMIA_HEADER_LENGTH);
>   			}
>   			else {
> -				netdev_err(
> -					dev->net,
> -					"Received unknown frame header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n",
> -					header_start[0], header_start[1],
> -					header_start[2], header_start[3],
> -					header_start[4], header_start[5],
> +				netdev_err(dev->net,
> +					"Received unknown frame header: %6phC. "
> +					"Package length: %i\n", header_start,

    Same here...

>   					skb->len - KALMIA_HEADER_LENGTH);
>   				return 0;
>   			}
>   		}
[...]
> @@ -310,12 +299,9 @@ kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
>   				sizeof(HEADER_END_OF_USB_PACKET)) == 0);
>   			if (!is_last) {
>   				header_start = skb->data + ether_packet_length;
> -				netdev_dbg(
> -					dev->net,
> -					"End header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n",
> -					header_start[0], header_start[1],
> -					header_start[2], header_start[3],
> -					header_start[4], header_start[5],
> +				netdev_dbg(dev->net,
> +					"End header: %6phC. Package length: %i"
> +					"\n", header_start,

    ... and here.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ