From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
X86 ML <x86@kernel.org>, Andy Lutomirski <luto@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Jan Beulich <JBeulich@suse.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] x86/ldt: silence a static checker warning
Date: Tue, 14 Jun 2016 13:44:29 +0300 [thread overview]
Message-ID: <20160614104429.GA32301@mwanda> (raw)
In-Reply-To: <CALCETrV0h+rAFBsjFGeLFGhzVOs3snHGVV=ECKDeXhpC1-mkjA@mail.gmail.com>
On Mon, Jun 13, 2016 at 02:14:39PM -0700, Andy Lutomirski wrote:
> On Sun, Jun 12, 2016 at 11:57 PM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
> > It likely doesn't make a difference but my static checker complains
> > that we put an upper bound on "size" but not a lower bound. Let's just
> > make it unsigned.
>
> Shouldn't oldsize and newsize in write_ldt as well as the "size"
> member in ldt_struct change, too?
>
Part of the joy of this check is that it complains about every time we
cap the upper bound and not the lower bound so it's very thourough, but
it also requires very minimal changes to silence the false positives.
We know newsize can't be negative. If we change this one variable
then we know oldsize and ldt_struct size can't be negative either.
The problem really is that I haven't figured out out to deal with
recursion...
new_ldt = alloc_ldt_struct(old_mm->context.ldt->size);
On the first run through, we don't know the value of ->size here so we
have to assume it can be anything.
regards,
dan carpenter
prev parent reply other threads:[~2016-06-14 10:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 6:57 [patch] x86/ldt: silence a static checker warning Dan Carpenter
2016-06-13 21:14 ` Andy Lutomirski
2016-06-14 10:44 ` Dan Carpenter [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=20160614104429.GA32301@mwanda \
--to=dan.carpenter@oracle.com \
--cc=JBeulich@suse.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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