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: <20140107.153424.1505811913811866788.davem@davemloft.net>
Date:	Tue, 07 Jan 2014 15:34:24 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	jeffrey.t.kirsher@...el.com
Cc:	mitch.a.williams@...el.com, netdev@...r.kernel.org,
	gospo@...hat.com, sassmann@...hat.com, jesse.brandeburg@...el.com
Subject: Re: [net-next 15/15] i40e: correctly setup ARQ descriptors

From: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
Date: Tue,  7 Jan 2014 01:32:29 -0800

> +	memset((void *)desc, 0, sizeof(struct i40e_aq_desc));

This is terrible.

First of all, no pointer need ever be cast when passed into memset()
because it accepts void * which is cleanly implicitly cast from any
pointer type.  That's the whole reason memset accepts a void pointer,
so people don't need to ever cast the argument.

Secondly, using an explicit type to compute the size of the third
argument is error prone.

So please code this as the canonical:

	memset(desc, 0, sizeof(*desc));

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