[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20150531.215055.1064973162484363630.davem@davemloft.net>
Date: Sun, 31 May 2015 21:50:55 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: f.fainelli@...il.com
Cc: netdev@...r.kernel.org, andrew@...n.ch, linux@...ck-us.net
Subject: Re: [PATCH net] net: dsa: Properly propagate errors from
dsa_switch_setup_one
From: Florian Fainelli <f.fainelli@...il.com>
Date: Fri, 29 May 2015 10:29:46 -0700
> While shuffling some code around, dsa_switch_setup_one() was introduced,
> and it was modified to return either an error code using ERR_PTR() or a
> NULL pointer when running out of memory or failing to setup a switch.
>
> This is a problem for its caler: dsa_switch_setup() which uses IS_ERR()
> and expects to find an error code, not a NULL pointer, so we still try
> to proceed with dsa_switch_setup() and operate on invalid memory
> addresses. This can be easily reproduced by having e.g: the bcm_sf2
> driver built-in, but having no such switch, such that drv->setup will
> fail.
>
> Fix this by using PTR_ERR() consistently which is both more informative
> and avoids for the caller to use IS_ERR_OR_NULL().
>
> Fixes: df197195a5248 ("net: dsa: split dsa_switch_setup into two functions")
> Reported-by: Andrew Lunn <andrew@...n.ch>
> Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
Applied, thanks Florian.
--
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