public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Georg Nikodym" <georgn@somanetworks.com>
To: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: [PATCH] memcmp() kernel janitor (was: memcmp() doesn't)
Date: 14 Feb 2002 09:39:24 -0500	[thread overview]
Message-ID: <1013697564.1764.8.camel@keller> (raw)
In-Reply-To: <1013572286.1581.95.camel@keller>
In-Reply-To: <1013572286.1581.95.camel@keller>

On Tue, 2002-02-12 at 22:51, Georg Nikodym wrote:

> I can supply patches in BK or regular form but I suspect it'd be easier
> for somebody "in the club" to simply make this change themselves.

At the prompting of Ingo Oeser, here's a patch.  A BK patch has already
been sent to Linus.

CSET comment:

  Fix generic memcmp() to correctly sign the return value.
  
  Non x86 architectures using memcmp() in situations where the sign
  of the return value matters would get the wrong answer (in 
  signed 8-bit arithmetic, 0 - 221 = 35, rather than the -221
  that many might assume/expect).

Patch:

--- a/lib/string.c	Thu Feb 14 09:33:48 2002
+++ b/lib/string.c	Thu Feb 14 09:33:48 2002
@@ -452,7 +452,7 @@
 int memcmp(const void * cs,const void * ct,size_t count)
 {
 	const unsigned char *su1, *su2;
-	signed char res = 0;
+	int res = 0;
 
 	for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
 		if ((res = *su1 - *su2) != 0)


      reply	other threads:[~2002-02-14 14:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-13  3:51 memcmp() doesn't Georg Nikodym
2002-02-14 14:39 ` Georg Nikodym [this message]

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=1013697564.1764.8.camel@keller \
    --to=georgn@somanetworks.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