All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Harry Zhang <harry.zhang@amd.com>
Cc: jgarzik@pobox.com, linux-ide@vger.kernel.org, hane.Huang@amd.com
Subject: Re: [PATCH 1/2 v4] ahci add "em_buffer" attribute for AHCI hosts
Date: Thu, 22 Apr 2010 17:34:33 +0200	[thread overview]
Message-ID: <4BD06C89.7060102@kernel.org> (raw)
In-Reply-To: <1271931333.3745.7.camel@zm-desktop>

Hello, Harry.

On 04/22/2010 12:15 PM, Harry Zhang wrote:
> +	/* Since EM buffer is in ABAR, commonly, the buffer size should be
> +	 * less than a page. Check buffer size against PAGE_SIZE in case of
> +	 * some rare instance. Only transfer the first page in this case.
> +	 */

Oh, the PAGE_SIZE limit comes from the way sysfs attributes are
implemented.  The kernel buffer sysfs uses is PAGE_SIZE so
reads/writes can't be larger than that.  If you write past PAGE_SIZE
from show, you'll corrupt someone else's memory.

> +	if (count > PAGE_SIZE) {
> +		dev_printk(KERN_WARNING, dev, 
> +			   "EM read buffer size %u is larger than %lu",
> +			   hpriv->em_buf_sz, PAGE_SIZE);
> +		count = PAGE_SIZE;
> +	}

It probably would be better to use ata_port_printk() and
printk_ratelimit() the message.

Thanks.

-- 
tejun

  reply	other threads:[~2010-04-22 15:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 10:15 [PATCH 1/2 v4] ahci add "em_buffer" attribute for AHCI hosts Harry Zhang
2010-04-22 15:34 ` Tejun Heo [this message]
2010-04-23  2:47   ` Harry Zhang
2010-04-23  6:27     ` Tejun Heo

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=4BD06C89.7060102@kernel.org \
    --to=tj@kernel.org \
    --cc=hane.Huang@amd.com \
    --cc=harry.zhang@amd.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@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.