From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-dev@lists.ozlabs.org
Cc: David Laight <David.Laight@aculab.com>,
'Arvind Yadav' <arvind.yadav.cs@gmail.com>,
"zajec5@gmail.com" <zajec5@gmail.com>,
"leoli@freescale.com" <leoli@freescale.com>,
"qiang.zhao@freescale.com" <qiang.zhao@freescale.com>,
"viresh.kumar@linaro.org" <viresh.kumar@linaro.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"scottwood@freescale.com" <scottwood@freescale.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux@roeck-us.net" <linux@roeck-us.net>
Subject: Re: [5.3] ucc_geth: Fix to avoid IS_ERR_VALUE abuses and dead code on 64bit systems.
Date: Mon, 08 Aug 2016 17:13:02 +0200 [thread overview]
Message-ID: <2862487.guU7g5Qkfj@wuerfel> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D5F50C493@AcuExch.aculab.com>
On Monday, August 8, 2016 2:49:11 PM CEST David Laight wrote:
>
> > If qe_muram_alloc will return any error, Then IS_ERR_VALUE will always
> > return 0. it'll not call ucc_fast_free for any failure. Inside 'if code'
> > will be a dead code on 64bit. Even qe_muram_addr will return wrong
> > virtual address. Which can cause an error.
> >
> > kfree((void *)ugeth->tx_bd_ring_offset[i]);
>
> Erm, kfree() isn't the right function for things allocated by qe_muram_alloc().
>
> I still thing you need to stop this code using IS_ERR_VALUE() at all.
Those are two separate issues:
a) The ucc_geth driver mixing kmalloc() memory with muram, and assigning
the result to "u32" and "void __iomem *" variables, both of which
are wrong at least half of the time.
b) calling conventions of qe_muram_alloc() being defined in a way that
requires the use of IS_ERR_VALUE(), because '0' is a valid address
here.
The first one can be solved by updating the network driver, ideally
by getting rid of the casts and using proper types and accessors,
while the second would require updating all users of that interface.
Arnd
next prev parent reply other threads:[~2016-08-08 15:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-05 8:40 [5.3] ucc_geth: Fix to avoid IS_ERR_VALUE abuses and dead code on 64bit systems Arvind Yadav
2016-08-08 14:49 ` David Laight
2016-08-08 15:13 ` Arnd Bergmann [this message]
2016-08-08 15:49 ` David Laight
2016-08-08 20:49 ` Arnd Bergmann
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=2862487.guU7g5Qkfj@wuerfel \
--to=arnd@arndb.de \
--cc=David.Laight@aculab.com \
--cc=akpm@linux-foundation.org \
--cc=arvind.yadav.cs@gmail.com \
--cc=leoli@freescale.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=qiang.zhao@freescale.com \
--cc=scottwood@freescale.com \
--cc=viresh.kumar@linaro.org \
--cc=zajec5@gmail.com \
/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