From: Warner Losh <imp-uzTCJ5RojNnQT0dZR+AlfA@public.gmane.org>
To: David Brown <davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 4/4] ARM: zImage: allow supplementing appended DTB with traditional ATAG data
Date: Tue, 21 Jun 2011 17:22:40 -0600 [thread overview]
Message-ID: <4ED56748-F76F-4A42-AFC2-76CF2099F1CA@bsdimp.com> (raw)
In-Reply-To: <8ya7h8edbhc.fsf-AOX6H5vLt3Uj8izMo0bVsAC/G2K4zDHf@public.gmane.org>
On Jun 21, 2011, at 5:13 PM, David Brown wrote:
> On Tue, Jun 21 2011, David Brown wrote:
>
>> On Mon, Jun 20 2011, Nicolas Pitre wrote:
>>
>>> +void *memmove(void *__dest, __const void *__src, size_t __n)
>>> +{
>>> + unsigned char *d = __dest;
>>> + const unsigned char *s = __src;
>>> +
>>> + if (__dest == __src)
>>> + return __dest;
>>> +
>>> + if (__dest < __src)
>>> + return memcpy(__dest, __src, __n);
>>> +
>>> + while (--__n >= 0)
>>> + d[__n] = s[__n];
>>> +
>>> + return __dest;
>>> +}
>>
>> Ahh, found it. size_t is unsigned, so the while loop never terminates.
>> Something like:
>>
>> for (; __n; __n--)
>> d[__n] = s[__n];
>
> Ugh. How about if I don't replace a broken version with a different
> broken version.
>
> while (__n) {
> __n--;
> d[__n] = s[__n];
> }
>
> Now, I don't need any extra fields in my DTB, and it correctly inserts
> the ATAG values.
while (__n--)
d[__n] = s[__n];
does the same thing, and is more readable (and does the same thing as the original while())
Warner
next prev parent reply other threads:[~2011-06-21 23:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-21 5:09 [PATCH 0/4] allow DTB to be appended to the ARM zImage with ATAG conversion Nicolas Pitre
[not found] ` <1308632955-11070-1-git-send-email-nico-vtqb6HGKxmzR7s880joybQ@public.gmane.org>
2011-06-21 5:09 ` [PATCH 1/4] ARM: zImage: ensure it is always a multiple of 64 bits in size Nicolas Pitre
2011-06-21 5:09 ` [PATCH 2/4] ARM: zImage: Allow the appending of a device tree binary Nicolas Pitre
2011-06-21 5:09 ` [PATCH 3/4] ARM: zImage: make sure appended DTB doesn't get overwritten by kernel .bss Nicolas Pitre
2011-06-21 5:09 ` [PATCH 4/4] ARM: zImage: allow supplementing appended DTB with traditional ATAG data Nicolas Pitre
[not found] ` <1308632955-11070-5-git-send-email-nico-vtqb6HGKxmzR7s880joybQ@public.gmane.org>
2011-06-21 7:00 ` Shawn Guo
2011-06-21 17:32 ` David Brown
2011-06-21 22:58 ` David Brown
2011-06-21 23:13 ` David Brown
[not found] ` <8ya7h8edbhc.fsf-AOX6H5vLt3Uj8izMo0bVsAC/G2K4zDHf@public.gmane.org>
2011-06-21 23:22 ` Warner Losh [this message]
2011-06-21 23:35 ` Nicolas Pitre
2011-06-21 21:59 ` [PATCH 0/4] allow DTB to be appended to the ARM zImage with ATAG conversion David Brown
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=4ED56748-F76F-4A42-AFC2-76CF2099F1CA@bsdimp.com \
--to=imp-uztcj5rojnnqt0dzr+alfa@public.gmane.org \
--cc=davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@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