All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: linux-btrace@vger.kernel.org
Subject: Re: [PATCH v2] blkparse: Avoid segfault for wrong cpu number.
Date: Thu, 26 May 2011 19:11:51 +0000	[thread overview]
Message-ID: <4DDEA5F7.5050404@kernel.dk> (raw)
In-Reply-To: <1306338552-11529-1-git-send-email-tm@tao.ma>

On 2011-05-25 17:49, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
> 
> Currently we only check the magic number to see whether
> a blktrace is valid or not, but Bill Broadley did meet
> with a case that the cpu info is wrong with a number
> of 1725552676. So in resize_cpu_info, we meet with a
> overflow when calculating
> size = new_count * sizeof(struct per_cpu_info);
> And the program will be either segfault or has the error
> of out of memory. Although this is more likely a kernel
> problem, the blkparse shoudn't segfault for it.
> 
> So this patch just check whether the cpu stored in the
> trace is the same as the file, if not, just warn it out
> and skip it.

Being a bit conservative doesn't hurt. Applied.

-- 
Jens Axboe


      reply	other threads:[~2011-05-26 19:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 15:49 [PATCH v2] blkparse: Avoid segfault for wrong cpu number Tao Ma
2011-05-26 19:11 ` Jens Axboe [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=4DDEA5F7.5050404@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-btrace@vger.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 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.