linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Khem Raj <raj.khem@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org, Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] powerpc/ptrace: Fix out of bounds array access warning
Date: Mon, 25 Apr 2016 03:46:26 -0500	[thread overview]
Message-ID: <20160425084626.GA1672@gate.crashing.org> (raw)
In-Reply-To: <1461564006-22331-1-git-send-email-raj.khem@gmail.com>

On Sun, Apr 24, 2016 at 11:00:06PM -0700, Khem Raj wrote:
> gcc-6 correctly warns about a out of bounds access
> 
> arch/powerpc/kernel/ptrace.c:407:24: warning: index 32 denotes an offset greater than size of 'u64[32][1] {aka long long unsigned int[32][1]}' [-Warray-bounds]
>         offsetof(struct thread_fp_state, fpr[32][0]));
>                         ^
> 
> check the end of array instead of beginning of next element to fix this

This should be fixed by doing

>         offsetof(struct thread_fp_state, fpr[32]));

instead; [31][1] is not the correct offset when TS_FPRWIDTH > 1.


Segher

      reply	other threads:[~2016-04-25  8:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25  6:00 [PATCH] powerpc/ptrace: Fix out of bounds array access warning Khem Raj
2016-04-25  8:46 ` Segher Boessenkool [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=20160425084626.GA1672@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=keescook@chromium.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=raj.khem@gmail.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 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 NNTP newsgroup(s).