Skip to content
Commit b0f55f2a authored by Joern Rennecke's avatar Joern Rennecke Committed by Linus Torvalds
Browse files

ARC: [lib] strchr breakage in Big-endian configuration



For a search buffer, 2 byte aligned, strchr() was returning pointer
outside of buffer (buf - 1)

------------->8----------------
    // Input buffer (default 4 byte aigned)
    char *buffer = "1AA_";

    // actual search start (to mimick 2 byte alignment)
    char *current_line = &(buffer[2]);

    // Character to search for
    char c = 'A';

    char *c_pos = strchr(current_line, c);

    printf("%s\n", c_pos) --> 'AA_' as oppose to 'A_'
------------->8----------------

Reported-by: default avatarAnton Kolesov <Anton.Kolesov@synopsys.com>
Debugged-by: default avatarAnton Kolesov <Anton.Kolesov@synopsys.com>
Cc: <stable@vger.kernel.org> # [3.9 and 3.10]
Cc: Noam Camus <noamc@ezchip.com>
Signed-off-by: default avatarJoern Rennecke <joern.rennecke@embecosm.com>
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 89b53e50
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment