All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ide: Correct the CHS 'cyls_max' limit to be 65535
@ 2016-01-18 10:19 Shmulik Ladkani
  2016-01-19 19:12 ` John Snow
  0 siblings, 1 reply; 2+ messages in thread
From: Shmulik Ladkani @ 2016-01-18 10:19 UTC (permalink / raw)
  To: John Snow
  Cc: Kevin Wolf, Shmulik Ladkani, Markus Armbruster, qemu-block,
	qemu-devel

In b7eb0c9:
  hw/block-common: Factor out fall back to legacy -drive cyls=...
'blkconf_geometry()' was introduced, factoring out CHS limit validation
code that was repeated in ide, scsi, virtio-blk.

The original IDE CHS limit prior b7eb0c9 was 65535,16,255 (as per ATA
CHS addressing).
However the 'cyls_max' argument passed to 'blkconf_geometry' in the
ide_dev_initfn case was accidentally set to 65536 instead of 65535.

Fix, providing the correct 'cyls_max'.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
---
 hw/ide/qdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 1f83109..fea5425 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -172,7 +172,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
 
     blkconf_serial(&dev->conf, &dev->serial);
     if (kind != IDE_CD) {
-        blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255, &err);
+        blkconf_geometry(&dev->conf, &dev->chs_trans, 65535, 16, 255, &err);
         if (err) {
             error_report_err(err);
             return -1;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] ide: Correct the CHS 'cyls_max' limit to be 65535
  2016-01-18 10:19 [Qemu-devel] [PATCH] ide: Correct the CHS 'cyls_max' limit to be 65535 Shmulik Ladkani
@ 2016-01-19 19:12 ` John Snow
  0 siblings, 0 replies; 2+ messages in thread
From: John Snow @ 2016-01-19 19:12 UTC (permalink / raw)
  To: Shmulik Ladkani; +Cc: Kevin Wolf, Markus Armbruster, qemu-block, qemu-devel



On 01/18/2016 05:19 AM, Shmulik Ladkani wrote:
> In b7eb0c9:
>   hw/block-common: Factor out fall back to legacy -drive cyls=...
> 'blkconf_geometry()' was introduced, factoring out CHS limit validation
> code that was repeated in ide, scsi, virtio-blk.
> 
> The original IDE CHS limit prior b7eb0c9 was 65535,16,255 (as per ATA
> CHS addressing).
> However the 'cyls_max' argument passed to 'blkconf_geometry' in the
> ide_dev_initfn case was accidentally set to 65536 instead of 65535.
> 
> Fix, providing the correct 'cyls_max'.
> 
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
> ---
>  hw/ide/qdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
> index 1f83109..fea5425 100644
> --- a/hw/ide/qdev.c
> +++ b/hw/ide/qdev.c
> @@ -172,7 +172,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
>  
>      blkconf_serial(&dev->conf, &dev->serial);
>      if (kind != IDE_CD) {
> -        blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255, &err);
> +        blkconf_geometry(&dev->conf, &dev->chs_trans, 65535, 16, 255, &err);
>          if (err) {
>              error_report_err(err);
>              return -1;
> 

Yep, this value eventually gets reported out via uint16_t, so 65535 is
correct.

Reviewed-by: John Snow <jsnow@redhat.com>

Thanks, applied to my IDE tree:

https://github.com/jnsnow/qemu/commits/ide
https://github.com/jnsnow/qemu.git

--js

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-19 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-18 10:19 [Qemu-devel] [PATCH] ide: Correct the CHS 'cyls_max' limit to be 65535 Shmulik Ladkani
2016-01-19 19:12 ` John Snow

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.