public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] net/eth.c: make eth_get_dev_by_name(NULL) safe
Date: Thu, 07 Jul 2011 12:24:25 +0200	[thread overview]
Message-ID: <m2k4bujsme.fsf@ohwell.denx.de> (raw)
In-Reply-To: <4E154E34.3090800@hale.at> (Helmut Raiger's message of "Thu, 07 Jul 2011 08:12:04 +0200")

Hi Helmut,

> On 07/06/2011 09:38 PM, Mike Frysinger wrote:
>> On Wednesday, July 06, 2011 03:15:08 Helmut Raiger wrote:
>>> On 07/05/2011 05:44 AM, Mike Frysinger wrote:
>>>> On Monday, July 04, 2011 06:29:51 helmut.raiger at hale.at wrote:
>>>>> eth_get_dev_by_name() is not safe to use for devname being NULL
>>>>> as it uses strcmp. This patch makes it return NULL if devname NULL
>>>>> is passed.
>>>> i'm not sure about this.  passing NULL is wrong, and the caller should
>>>> catch that shouldnt it ?
>>> So what is your suggestion how to deal with it?
>> in what situation is eth_get_dev_by_name(NULL) being called ?  my suggestion
>> would be to fix that call point since it's doing something wrong.
>> -mike
> I couldn't find a situation where this might be the case. But as Luca 
> Ceresoli pointed out in his e-mail, somewhere up the thread, that he 
> tested for devname being NULL in his miiphy_read and write routines, I 
> checked eth_get_dev_by_name() and found that it is vulnerable to passing 
> a NULL pointer, hence the fix.
>
> Is there something missing for the patch to be acknowledged?
> It's hanging there quite a while now?

Actually I want to ack your patch.  eth_get_dev_by_name is a project
wide utility function and as such should be tolerant to being called
with wrong parameters.

Mike's argument of course also has merit to it, but because of the
"library function" argument, I'd give it less priority.  So

Acked-by: Detlev Zundel <dzu@denx.de>

-- 
We have a live-manual.  It's called emacs-devel at gnu.org.
You can stick to just reading it, but you can skip to a specific chapter
by simply sending an email asking for it ;-)
                                    -- Stefan Monnier
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

  reply	other threads:[~2011-07-07 10:24 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-20  6:10 [U-Boot] [U-Boot PATCH MX31:] smc911x MII made available Helmut.Raiger at hale.at
2011-06-20 12:30 ` Stefano Babic
2011-06-20 14:36   ` Helmut Raiger
2011-06-27  7:22   ` [U-Boot] [PATCH] " helmut.raiger at hale.at
2011-06-27 19:29     ` Mike Frysinger
2011-06-29 10:12       ` helmut.raiger at hale.at
2011-06-30 13:57         ` Luca Ceresoli
2011-06-30 14:02           ` [U-Boot] [PATCH RFC] smc911x: enable mii commands Luca Ceresoli
2011-07-04  9:41             ` Helmut Raiger
2011-07-04 10:29               ` [U-Boot] [PATCH 1/2] net/eth.c: make eth_get_dev_by_name(NULL) safe helmut.raiger at hale.at
2011-07-04 10:29                 ` [U-Boot] [PATCH 2/2] smc911x MII made available helmut.raiger at hale.at
2011-09-07 12:33                   ` [U-Boot] [U-Boot,2/2] " Stefano Babic
2011-09-07 13:06                     ` Helmut Raiger
2011-09-07 13:12                       ` Stefano Babic
2011-09-07 21:50                   ` [U-Boot] [PATCH 2/2] " Wolfgang Denk
2011-09-08 11:04                   ` [U-Boot] [PATCH] smc911x: Fix build warnings Wolfgang Denk
2011-09-09 21:57                     ` Wolfgang Denk
2011-07-05  3:44                 ` [U-Boot] [PATCH 1/2] net/eth.c: make eth_get_dev_by_name(NULL) safe Mike Frysinger
2011-07-06  7:15                   ` Helmut Raiger
2011-07-06 19:38                     ` Mike Frysinger
2011-07-07  6:12                       ` Helmut Raiger
2011-07-07 10:24                         ` Detlev Zundel [this message]
2011-07-07 17:46                         ` Mike Frysinger
2011-07-11  9:53                           ` Helmut Raiger
2011-07-12  6:37                             ` Mike Frysinger
2011-07-12  9:22                               ` Detlev Zundel
2011-07-12 20:49                                 ` Mike Frysinger
2011-07-13 11:34                                   ` Detlev Zundel
2011-07-13  6:32                                 ` Helmut Raiger
2011-07-13 11:46                                   ` Detlev Zundel
2011-07-14  9:14                                     ` Helmut Raiger
2011-07-14 17:58                                       ` Mike Frysinger
2011-08-22  8:45                                     ` [U-Boot] [PATCH V2 1/2] net/eth.c: throw BUG for eth_get_dev_by_name(NULL) Helmut Raiger
2011-08-22 10:05                                       ` Sergei Shtylyov
2011-08-22 10:17                                         ` [U-Boot] [PATCH " Helmut Raiger
2011-08-22 16:05                                           ` Mike Frysinger
2011-09-08 11:08                                           ` Wolfgang Denk
2011-07-14 18:24                                   ` [U-Boot] [PATCH 1/2] net/eth.c: make eth_get_dev_by_name(NULL) safe Mike Frysinger
2011-07-07 16:46                 ` Albert ARIBAUD
2011-07-11 10:10                   ` Helmut Raiger
2011-07-14 13:53                     ` Albert ARIBAUD
2011-08-31  7:41 ` [U-Boot] Anything missing? Helmut Raiger
2011-08-31  7:45   ` Wolfgang Denk
2011-09-07  5:40 ` [U-Boot] [U-Boot PATCH MX31:] smc911x MII made available, ping? Helmut Raiger
2011-09-07 12:37   ` Stefano Babic
2011-09-07 21:47     ` Wolfgang Denk
2011-09-08  6:13       ` Helmut Raiger

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=m2k4bujsme.fsf@ohwell.denx.de \
    --to=dzu@denx.de \
    --cc=u-boot@lists.denx.de \
    /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