netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ville Nuorvala <vnuorval@tcs.hut.fi>
To: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] IPv6: Fix NULL dereference in ipv6_del_addr()
Date: Fri, 17 Nov 2006 21:27:21 +0200	[thread overview]
Message-ID: <455E0D19.1060405@tcs.hut.fi> (raw)
In-Reply-To: <20061117.232623.61341274.yoshfuji@linux-ipv6.org>

YOSHIFUJI Hideaki wrote:
> In article <455DB884.3050203@tcs.hut.fi> (at Fri, 17 Nov 2006 15:26:28 +0200), Ville Nuorvala <vnuorval@tcs.hut.fi> says:
> 
> 
>> -		dst_release(&rt->u.dst);
>> +		if (rt)
>> +			dst_release(&rt->u.dst);
>>  	}
> 
> I disagree.  This does NOT fix any bugs.
> 
> (void *)&rt->u.dst is ever equal to (void*)rt, and
> dst_release() checks if the argument is NULL.

As the check is unnecessary you probably want to clean up the other 
places where rt is checked before &rt->u.dst is passed, as well ;-)
This is done at least in addrconf.c, ndisc.c and route.c...

Seriously though, you are probably right about the pointer being equal 
to NULL in this case,  but does the C language actually guarantee that 
the pointer to the structure and its first element are equal, or is it 
implementation dependent? I don't have my K&R here, so I can't check.

Regards,
Ville



  reply	other threads:[~2006-11-17 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-17 13:26 [PATCH] IPv6: Fix NULL dereference in ipv6_del_addr() Ville Nuorvala
2006-11-17 14:26 ` YOSHIFUJI Hideaki / 吉藤英明
2006-11-17 19:27   ` Ville Nuorvala [this message]
2006-11-19 22:51     ` David Miller

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=455E0D19.1060405@tcs.hut.fi \
    --to=vnuorval@tcs.hut.fi \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).