Re: [PATCH 1/2 v4] ahci add "em_buffer" attribute for AHCI hosts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux