From: Vladimir Murzin <murzin.v@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm: memset: zero out upper bytes in r1
Date: Thu, 8 May 2014 08:38:46 +0000 (UTC) [thread overview]
Message-ID: <loom.20140508T103032-725@post.gmane.org> (raw)
In-Reply-To: <loom.20140508T095105-952@post.gmane.org>
Vladimir Murzin <murzin.v <at> gmail.com> writes:
>
> Andrey Ryabinin <a.ryabinin <at> samsung.com> writes:
>
> >
> > memset doesn't work right for following example:
> >
> > signed char c = 0xF0;
> > memset(addr, c, size);
> >
> > Variable c is signed, so after typcasting to int the value will be
0xFFFFFFF0.
> > This value will be passed through r1 regitster to memset function.
> > memset doesn't zero out upper bytes in r1, so memory will be filled
> > with 0xFFFFFFF0 instead of expected 0xF0F0F0F0.
>
> It behaves the same as a generic implementation in lib/string.c, moreover
> gcc built-in behaves the same. So it looks like expected behavior and POSIX
> Programmer's Manual (man 3posix memset) explicitly says that "c" is
> converted to unsigned char.
>
> Cheers
> Vladimir
>
>
Sorry, had a bad coffee when posted it ;) It behaves /different/, but it is
here for many years... doesn't this change break something? iow, it possible
that some user rely on this behavior...
Vladimir
next prev parent reply other threads:[~2014-05-08 8:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 7:11 Andrey Ryabinin
2014-05-07 23:42 ` Afzal Mohammed
2014-05-08 7:59 ` Andrey Ryabinin
2014-05-08 14:40 ` Andrey Ryabinin
2014-05-08 8:04 ` Vladimir Murzin
2014-05-08 8:38 ` Vladimir Murzin [this message]
2014-05-12 6:58 ` Andrey Ryabinin
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=loom.20140508T103032-725@post.gmane.org \
--to=murzin.v@gmail.com \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome