All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Fwd: New Defects reported by Coverity Scan for Linux
Date: Sat, 12 Apr 2014 15:41:29 -0700	[thread overview]
Message-ID: <5349C119.7050208@zytor.com> (raw)
In-Reply-To: <20140412214145.GL18465@intel.com>

On 04/12/2014 02:41 PM, Ville Syrjälä wrote:
> On Sat, Apr 12, 2014 at 07:29:29AM -0600, Bjorn Helgaas wrote:
>> FYI, looks like these were added by a4dff76924fe ("x86/gpu: Add Intel
>> graphics stolen memory quirk for gen2 platforms").
> 
> Some of the affected gen2 platforms do support up to 2GB of RAM which
> means that if the sign extension were to happen they could hit this.
> However I believe all gen2 platforms are 32bit which AFAIK makes size_t 
> 32 bits. So looks like we can't hit this in practice..
> 
> But if someone were to change the return type to 64bits we'd
> be in real danger, so I guess it would be better to fix the bug
> anyway.
> 
> -#define KB(x)  ((x) * 1024)
> +#define KB(x)  ((x) * 1024U)
> should be sufficient to eliminate the problem. If someone wants me to
> put that into a real patch and send it out let me know.
> 

Please do, but make it UL (in the Linux kernel context, unsigned long is
always equivalent to size_t/pointer size.)

	-hpa



  reply	other threads:[~2014-04-12 22:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5348ea4572e7_5d4d7ac86c27677@209.249.196.67.mail>
2014-04-12 13:29 ` Fwd: New Defects reported by Coverity Scan for Linux Bjorn Helgaas
2014-04-12 21:41   ` Ville Syrjälä
2014-04-12 22:41     ` H. Peter Anvin [this message]
2014-04-13  9:45       ` [PATCH] x86/gpu: Fix sign extension issue in Intel graphics stolen memory quirks ville.syrjala
2014-04-14  7:22         ` [tip:x86/urgent] " tip-bot for Ville Syrjälä
2014-04-12 13:38 ` Fwd: New Defects reported by Coverity Scan for Linux Bjorn Helgaas
2014-04-12 13:44 ` Bjorn Helgaas
2017-11-27 13:22 Richard Weinberger
     [not found] <5b5555e19b5af_5e922b08291e2f60744cb@node1.mail>
2018-07-23 19:12 ` Bjorn Helgaas
2018-07-23 20:54   ` Bjorn Helgaas
2018-07-25 14:21     ` Gustavo A. R. Silva

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=5349C119.7050208@zytor.com \
    --to=hpa@zytor.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=ville.syrjala@linux.intel.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.