public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@redhat.com>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	Vince Weaver <vince@deater.net>,
	Stephane Eranian <eranian@google.com>,
	Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH v2 1/6] perf: Introduce extended syscall error reporting
Date: Tue, 01 Sep 2015 09:38:13 +0300	[thread overview]
Message-ID: <87vbbu63vu.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <CAHp75VfEo644UcOr2YWS3usBBOtxGVciaL4j8fjtomk69x=+3g@mail.gmail.com>

Andy Shevchenko <andy.shevchenko@gmail.com> writes:

> On Mon, Aug 24, 2015 at 5:32 PM, Alexander Shishkin
> <alexander.shishkin@linux.intel.com> wrote:
>> +       /* trim the buffer to the supplied boundary */
>> +       len = strlen(buffer);
>> +       if (len >= attr->perf_err_size) {
>> +               len = attr->perf_err_size - 1;
>> +               buffer[len] = 0;
>> +       }
>
> len = strnlen(buffer, attr->perf_err_size);
> buffer[len] = 0;
>
> And perhaps perf_err_size has to be length (perf_err_len) ?
>
>> +
>> +       if (copy_to_user((void __user *)attr->perf_err, buffer, len + 1)) {
>> +               /* if we failed to copy once, don't bother later */
>> +               attr->perf_err_size = 0;
>
> Kaboom next time on buffer[-1] = 0; since len >= 0?

Of course, we never get here if attr::perf_err_size is 0, there's an
explicit check for that, but nice try.

Regards,
--
Alex

  reply	other threads:[~2015-09-01  6:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 14:32 [PATCH v2 0/6] perf: Introduce extended syscall error reporting Alexander Shishkin
2015-08-24 14:32 ` [PATCH v2 1/6] " Alexander Shishkin
2015-08-31 18:47   ` Andy Shevchenko
2015-09-01  6:38     ` Alexander Shishkin [this message]
2015-08-24 14:32 ` [PATCH v2 2/6] perf: Add file name and line number to perf extended error reports Alexander Shishkin
2015-08-24 14:32 ` [PATCH v2 3/6] perf: Annotate some of the error codes with perf_err() Alexander Shishkin
2015-08-24 14:32 ` [PATCH v2 4/6] perf/x86: " Alexander Shishkin
2015-08-24 14:32 ` [PATCH v2 5/6] perf/x86/intel/pt: Use extended error reporting in event initialization Alexander Shishkin
2015-08-24 14:33 ` [PATCH v2 6/6] perf/x86/intel/bts: " Alexander Shishkin
2015-08-25  8:22 ` [PATCH v2 0/6] perf: Introduce extended syscall error reporting Ingo Molnar
2015-08-25  8:52 ` Johannes Berg
2015-08-25  9:02   ` Ingo Molnar
2015-08-25  9:17     ` Ingo Molnar
2015-08-25  9:34       ` Johannes Berg
2015-08-25 10:07         ` Ingo Molnar
2015-08-25 10:19           ` Johannes Berg
2015-08-26  4:49             ` Ingo Molnar
     [not found]               ` <CA+55aFw--OFczoY=v17+e2-Q3O0GXnMKRuwzpYpB2qKBpZo=fw@mail.gmail.com>
2015-08-26  7:02                 ` Ingo Molnar
2015-08-26  7:06                 ` Johannes Berg
2015-08-26  7:20                   ` Ingo Molnar
2015-08-26  7:26                     ` Ingo Molnar
2015-08-26 16:56                       ` Alexander Shishkin
2015-08-26 20:58                         ` Arnaldo Carvalho de Melo
2015-09-11 16:11                           ` Alexander Shishkin
2015-08-26 18:41                       ` Andrew Morton
2015-08-26 20:05                         ` Peter Zijlstra
2015-08-26 20:22                           ` Andrew Morton
2015-08-26 20:50                             ` Vince Weaver
2015-08-26 20:56                               ` Andrew Morton
2015-08-26 21:14                                 ` Vince Weaver
2015-08-28 10:07                             ` Ingo Molnar
2015-08-26 21:04                         ` Arnaldo Carvalho de Melo
2015-08-26  7:36                     ` Johannes Berg
2015-08-26 11:37       ` Alexander Shishkin

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=87vbbu63vu.fsf@ashishki-desk.ger.corp.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@infradead.org \
    --cc=adrian.hunter@intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=eranian@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=vince@deater.net \
    /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