From: Russell King - ARM Linux <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Haojian Zhuang
<haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 2/8] serial: pxa: add OF support
Date: Thu, 1 Mar 2012 09:48:53 +0000 [thread overview]
Message-ID: <20120301094853.GA7363@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <201203010947.39601.arnd-r2nGTMty4D4@public.gmane.org>
On Thu, Mar 01, 2012 at 09:47:39AM +0000, Arnd Bergmann wrote:
> On Thursday 01 March 2012, Haojian Zhuang wrote:
> > @@ -792,7 +826,7 @@ static int serial_pxa_probe(struct platform_device *dev)
> > if (!mmres || !irqres)
> > return -ENODEV;
> >
> > - sport = kzalloc(sizeof(struct uart_pxa_port), GFP_KERNEL);
> > + sport = kzalloc(sizeof(struct uart_pxa_port) + 8, GFP_KERNEL);
> > if (!sport)
> > return -ENOMEM;
> >
> > @@ -808,20 +842,18 @@ static int serial_pxa_probe(struct platform_device *dev)
> > + ret = serial_pxa_probe_dt(dev, sport);
> > + if (ret > 0)
> > + sport->port.line = dev->id;
> > + else if (ret < 0)
> > + goto err_clk;
> > + sport->name = (char *)((unsigned int)sport + 8);
> > + /* name can't exceed 8 bytes */
> > + sprintf(sport->name, "UART%d", sport->port.line + 1);
>
> The pointer arithmetic looks wrong to me, both technically and morally ;-)
>
> Since struct uart_pxa_port is a local data structure, why don't you just
> turn the name field into a fixed-length array?
and then use snprintf() to ensure that it doesn't overflow.
next prev parent reply other threads:[~2012-03-01 9:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
2012-03-01 6:10 ` [PATCH 1/8] gpio: pxa: add OF support Haojian Zhuang
[not found] ` <1330582228-12424-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-03-01 9:40 ` Arnd Bergmann
[not found] ` <201203010940.37123.arnd-r2nGTMty4D4@public.gmane.org>
2012-03-01 9:51 ` Arnd Bergmann
2012-03-01 6:10 ` [PATCH 2/8] serial: " Haojian Zhuang
[not found] ` <1330582228-12424-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-03-01 9:47 ` Arnd Bergmann
[not found] ` <201203010947.39601.arnd-r2nGTMty4D4@public.gmane.org>
2012-03-01 9:48 ` Russell King - ARM Linux [this message]
[not found] ` <20120301094853.GA7363-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2012-03-01 12:55 ` Haojian Zhuang
2012-03-01 6:10 ` [PATCH 3/8] rtc: sa1100: " Haojian Zhuang
[not found] ` <1330582228-12424-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-03-01 9:51 ` Arnd Bergmann
[not found] ` <201203010951.12405.arnd-r2nGTMty4D4@public.gmane.org>
2012-03-01 12:52 ` Haojian Zhuang
2012-03-01 6:10 ` [PATCH 4/8] i2c: pxa: " Haojian Zhuang
[not found] ` <1330582228-12424-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-03-01 10:01 ` Arnd Bergmann
2012-03-01 6:10 ` [PATCH 5/8] ARM: mmp: enable rtc clk in pxa168 Haojian Zhuang
2012-03-01 6:10 ` [PATCH 6/8] ARM: mmp: append OF support on pxa168 Haojian Zhuang
2012-03-01 6:10 ` [PATCH 7/8] ARM: dts: append DTS file of pxa168 Haojian Zhuang
2012-03-01 6:10 ` [PATCH 8/8] Document: devicetree: add OF documents for arch-mmp Haojian Zhuang
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=20120301094853.GA7363@n2100.arm.linux.org.uk \
--to=linux-lfz/pmaqli7xmaaqvzeohq@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.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).