All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Alfred Arnold <aarnold@elsa.de>
Subject: [BUG 2.2/2.4/2.6] broken memsets in net/sk_mca.c (multicast)
Date: Sat, 10 Apr 2004 10:20:40 +0200	[thread overview]
Message-ID: <20040410102040.022ffb3c.khali@linux-fr.org> (raw)

[Please CC: me on reply, I'm not subscribed (yet)]

Hi all,

I just found two very weird memsets in drivers/net/sk_mca.c. I am not
working on that driver at all, but some grepping of the kernel source
pointed me to it so I thought I wouldn't keep quiet about it.

Here is the offending code:

static void skmca_set_multicast_list(struct net_device *dev)
{
	(...)
	if (dev->flags & IFF_ALLMULTI) {	/* get all multicasts */
		memset(block.LAdrF, 8, 0xff);
	} else {		/* get selected/no multicasts */
		(...)
		memset(block.LAdrF, 8, 0x00);
		(...)
	}
	(...)
}

Is it just me, or are these two memsets just plain broken? Not only the
size is hardcoded, but the parameters are swapped! I guess that this
driver never worked in multicast mode. The correct memsets are
obviously:
		memset(block.LAdrF, 0xff, sizeof(block.LAdrF));
and
		memset(block.LAdrF, 0x00, sizeof(block.LAdrF));
respectively.

The odd thing is that the bug is there since the driver was introduced
in the 2.2.10 kernel. So, 2.2, 2.4 and 2.6 kernels are all affected.

I admit I'm a bit surprized that this could survive until today, so just
tell me if it's me missing the point ;)

Thanks.

-- 
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/

             reply	other threads:[~2004-04-10  8:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-10  8:20 Jean Delvare [this message]
2004-04-10  8:40 ` [BUG 2.2/2.4/2.6] broken memsets in net/sk_mca.c (multicast) Andrew Morton
2004-04-10  8:49   ` Russell King
2004-04-10  8:59     ` Andrew Morton
2004-04-10 14:49       ` Jean Delvare
2004-04-10 11:52 ` Denis Vlasenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040410102040.022ffb3c.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=aarnold@elsa.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.