All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <jejb@linux.vnet.ibm.com>
To: Colin King <colin.king@canonical.com>,
	Hannes Reinecke <hare@suse.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: aic7xxx: Fix unintended sign extension issue
Date: Thu, 25 Oct 2018 15:32:49 +0000	[thread overview]
Message-ID: <1540481569.3006.5.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <20181025151334.15622-1-colin.king@canonical.com>

On Thu, 2018-10-25 at 16:13 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> In the expression "ahc_inb(ahc, port+3) << 24", the initial value is
> a u8, but is promoted to a signed int, then sign-extended to
> uint64_t.

Why is this, that's highly non intuitive?  The compiler is supposed to
promote to the biggest type, which is uint64_t and then do the
calculation

James

WARNING: multiple messages have this Message-ID (diff)
From: James Bottomley <jejb@linux.vnet.ibm.com>
To: Colin King <colin.king@canonical.com>,
	Hannes Reinecke <hare@suse.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: aic7xxx: Fix unintended sign extension issue
Date: Thu, 25 Oct 2018 16:32:49 +0100	[thread overview]
Message-ID: <1540481569.3006.5.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <20181025151334.15622-1-colin.king@canonical.com>

On Thu, 2018-10-25 at 16:13 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> In the expression "ahc_inb(ahc, port+3) << 24", the initial value is
> a u8, but is promoted to a signed int, then sign-extended to
> uint64_t.

Why is this, that's highly non intuitive?  The compiler is supposed to
promote to the biggest type, which is uint64_t and then do the
calculation

James

  parent reply	other threads:[~2018-10-25 15:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25 15:13 [PATCH] scsi: aic7xxx: Fix unintended sign extension issue Colin King
2018-10-25 15:13 ` Colin King
2018-10-25 15:32 ` Joe Perches
2018-10-25 15:32   ` Joe Perches
2018-10-25 15:32 ` James Bottomley [this message]
2018-10-25 15:32   ` James Bottomley
2018-10-25 15:54   ` David Laight
2018-10-25 15:54     ` David Laight
2019-10-14 12:56 ` [PATCH] scsi: aic7xxx: fix unintended sign extension on left shifts Colin King
2019-10-14 12:56   ` Colin King

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=1540481569.3006.5.camel@linux.vnet.ibm.com \
    --to=jejb@linux.vnet.ibm.com \
    --cc=colin.king@canonical.com \
    --cc=hare@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.