git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: Fix big left-shifts of unsigned char
Date: Thu, 18 Jun 2009 09:08:35 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0906180856420.16802@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.1.00.0906181012050.4848@intel-tinevez-2-302>



On Thu, 18 Jun 2009, Johannes Schindelin wrote:
> 
> I wonder if there is a mode of 'sparse' which could spot these buggers.

Hmm. A very quick hack gets me (this is _after_ my patch):

	diffcore-delta.c:53:24: warning: Signed left-shift
	diffcore-delta.c:58:21: warning: Signed left-shift
	diffcore-delta.c:88:21: warning: Signed left-shift

which are all of the type "<< alloc_log", and not very interesting.

	read-cache.c:1155:17: warning: Signed left-shift

This one is "real", and I noticed it in my earlier greps, but we don't 
care (it's the CACHE_EXT_TREE/CACHE_EXT() matching, and it's all done in 
"int", and the only case we care about is a non-signed case anyway)

	imap-send.c:785:52: warning: Signed left-shift
	imap-send.c:1190:35: warning: Signed left-shift

These are both "real", but we're only working on "unsigned" so we don't 
really care.

	builtin-rev-list.c:201:21: warning: Signed left-shift

this is exp2i(), and it returns 'int', and wouldn't work for big left 
shifts anyway.

And just to see that my sparse logic actually worked, _without_ the patch 
I sent to fix left-shifts, I got these:

	base85.c:95:38: warning: Signed left-shift		(fixed)
	diffcore-delta.c:53:24: warning: Signed left-shift
	diffcore-delta.c:58:21: warning: Signed left-shift
	diffcore-delta.c:88:21: warning: Signed left-shift
	delta.h:98:42: warning: Signed left-shift		(fixed)
	delta.h:98:42: warning: Signed left-shift		(dup - inline)
	patch-delta.c:47:63: warning: Signed left-shift		(fixed)
	read-cache.c:1155:17: warning: Signed left-shift
	sha1_file.c:1179:39: warning: Signed left-shift		(fixed)
	delta.h:98:42: warning: Signed left-shift		(dup - inline)
	delta.h:98:42: warning: Signed left-shift		(dup - inline)
	imap-send.c:785:52: warning: Signed left-shift
	imap-send.c:1190:35: warning: Signed left-shift
	builtin-rev-list.c:201:21: warning: Signed left-shift
	builtin-unpack-objects.c:441:39: warning: Signed left-shift (fixed)

just to verify that my sparse checker actually found the ones the patch 
modified.

			Linus

  parent reply	other threads:[~2009-06-18 16:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-14 20:03 [PATCH] Cast things properly to handle >2G files Alfred M. Szmidt
2009-06-14 20:17 ` Johannes Schindelin
2009-06-15  2:43   ` Nicolas Pitre
2009-06-15  3:39   ` Alfred M. Szmidt
2009-06-15  4:06     ` Junio C Hamano
2009-06-15  8:45       ` Johannes Schindelin
2009-06-15  4:25     ` Linus Torvalds
2009-06-17 22:27       ` Alfred M. Szmidt
2009-06-17 22:48         ` Linus Torvalds
2009-06-17 22:27       ` Alfred M. Szmidt
2009-06-17 22:45         ` Linus Torvalds
2009-06-17 23:16           ` Junio C Hamano
2009-06-18  0:22           ` Fix big left-shifts of unsigned char Linus Torvalds
2009-06-18  8:12             ` Johannes Schindelin
2009-06-18  8:21               ` Junio C Hamano
2009-06-18 16:08               ` Linus Torvalds [this message]
2009-06-18 16:45                 ` Johannes Schindelin
2009-06-18 17:15                   ` Linus Torvalds
2009-06-18 17:28                     ` Fix various sparse warnings in the git source code Linus Torvalds
2009-06-18 17:45                       ` Matthieu Moy
2009-06-18 17:52                         ` Linus Torvalds
2009-06-18 21:48                       ` Linus Torvalds
2009-06-17 22:51         ` [PATCH] Cast things properly to handle >2G files Linus Torvalds

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.01.0906180856420.16802@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).