linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: petkovbb@gmail.com
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/6] ide: more unifications of ATA and ATAPI support
Date: Mon, 23 Feb 2009 23:51:17 +0100	[thread overview]
Message-ID: <200902232351.17723.bzolnier@gmail.com> (raw)
In-Reply-To: <20090211071640.GD937@gollum.tnic>

On Wednesday 11 February 2009, Borislav Petkov wrote:
> On Tue, Feb 10, 2009 at 12:19:45AM +0100, Bartlomiej Zolnierkiewicz wrote:
> > 
> > After this patchset we have a valid struct ide_cmd available also for
> > ATA_CMD_PACKET commands and comparing struct ide_atapi_pc with ide_cmd it
> > seems that there are many similarities between them and that we may just
> > merge both structs (this should also allow us to unify ide-cd code with
> > non-ide-cd one in ide-atapi.c later).  From the quick look the only gotcha

There is another gotcha there and this one is worth fixing indpendently of
struct ide_atapi_pc and struct ide_cmd merge:

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: decrease size of ->pc_buf field in struct ide_atapi_pc

struct ide_atapi_pc is often allocated on the stack and size of ->pc_buf
size is 256 bytes.  However since only ide_floppy_create_read_capacity_cmd()
and idetape_create_inquiry_cmd() require such size allocate buffers for
these pc-s explicitely and decrease ->pc_buf size to 64 bytes.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-floppy.c       |    5 ++++-
 drivers/ide/ide-floppy_ioctl.c |    5 ++++-
 drivers/ide/ide-tape.c         |    4 ++++
 include/linux/ide.h            |    2 +-
 4 files changed, 13 insertions(+), 3 deletions(-)

Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -377,7 +377,7 @@ static int ide_floppy_get_capacity(ide_d
 	struct gendisk *disk = floppy->disk;
 	struct ide_atapi_pc pc;
 	u8 *cap_desc;
-	u8 header_len, desc_cnt;
+	u8 pc_buf[256], header_len, desc_cnt;
 	int i, rc = 1, blocks, length;
 
 	drive->bios_cyl = 0;
@@ -387,6 +387,9 @@ static int ide_floppy_get_capacity(ide_d
 	drive->capacity64 = 0;
 
 	ide_floppy_create_read_capacity_cmd(&pc);
+	pc.buf = &pc_buf[0];
+	pc.buf_size = sizeof(pc_buf);
+
 	if (ide_queue_pc_tail(drive, disk, &pc)) {
 		printk(KERN_ERR PFX "Can't get floppy parameters\n");
 		return 1;
Index: b/drivers/ide/ide-floppy_ioctl.c
===================================================================
--- a/drivers/ide/ide-floppy_ioctl.c
+++ b/drivers/ide/ide-floppy_ioctl.c
@@ -36,9 +36,9 @@ static int ide_floppy_get_format_capacit
 					    int __user *arg)
 {
 	struct ide_disk_obj *floppy = drive->driver_data;
-	u8 header_len, desc_cnt;
 	int i, blocks, length, u_array_size, u_index;
 	int __user *argp;
+	u8 pc_buf[256], header_len, desc_cnt;
 
 	if (get_user(u_array_size, arg))
 		return -EFAULT;
@@ -47,6 +47,9 @@ static int ide_floppy_get_format_capacit
 		return -EINVAL;
 
 	ide_floppy_create_read_capacity_cmd(pc);
+	pc->buf = &pc_buf[0];
+	pc->buf_size = sizeof(pc_buf);
+
 	if (ide_queue_pc_tail(drive, floppy->disk, pc)) {
 		printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n");
 		return -EIO;
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2014,9 +2014,13 @@ static void idetape_get_inquiry_results(
 {
 	idetape_tape_t *tape = drive->driver_data;
 	struct ide_atapi_pc pc;
+	u8 pc_buf[256];
 	char fw_rev[4], vendor_id[8], product_id[16];
 
 	idetape_create_inquiry_cmd(&pc);
+	pc.buf = &pc_buf[0];
+	pc.buf_size = sizeof(pc_buf);
+
 	if (ide_queue_pc_tail(drive, tape->disk, &pc)) {
 		printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n",
 				tape->name);
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -377,7 +377,7 @@ enum {
  * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
  * This is used for several packet commands (not for READ/WRITE commands).
  */
-#define IDE_PC_BUFFER_SIZE	256
+#define IDE_PC_BUFFER_SIZE	64
 #define ATAPI_WAIT_PC		(60 * HZ)
 
 struct ide_atapi_pc {


      reply	other threads:[~2009-02-23 22:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09 23:19 [PATCH 0/6] ide: more unifications of ATA and ATAPI support Bartlomiej Zolnierkiewicz
2009-02-09 23:19 ` [PATCH 1/6] ide: pass command to ide_map_sg() Bartlomiej Zolnierkiewicz
2009-02-11  6:36   ` Borislav Petkov
2009-02-11 16:28     ` Bartlomiej Zolnierkiewicz
2009-02-09 23:19 ` [PATCH 2/6] ide: use do_rw_taskfile() for ATA_CMD_PACKET commands Bartlomiej Zolnierkiewicz
2009-02-09 23:20 ` [PATCH 3/6] ide: set hwif->expiry prior to calling [__]ide_set_handler() Bartlomiej Zolnierkiewicz
2009-03-16 14:23   ` Sergei Shtylyov
2009-02-09 23:20 ` [PATCH 4/6] ide: add ->dma_expiry method and remove ->dma_exec_cmd one Bartlomiej Zolnierkiewicz
2009-02-10 18:18   ` Sergei Shtylyov
2009-02-11 16:30     ` Bartlomiej Zolnierkiewicz
2009-02-11 17:30       ` Sergei Shtylyov
2009-02-17 14:16         ` Bartlomiej Zolnierkiewicz
2009-02-17 14:29           ` Sergei Shtylyov
2009-02-09 23:20 ` [PATCH 5/6] ide: remove ide_execute_pkt_cmd() Bartlomiej Zolnierkiewicz
2009-02-11  6:55   ` Borislav Petkov
2009-02-11 13:22     ` Sergei Shtylyov
2009-02-11 13:37       ` Borislav Petkov
2009-02-11 13:49         ` Sergei Shtylyov
2009-02-11 16:32           ` Borislav Petkov
2009-02-15 12:24             ` Sergei Shtylyov
2009-02-15 17:39               ` Borislav Petkov
2009-02-15 23:18                 ` Sergei Shtylyov
2009-02-16  8:56                   ` Borislav Petkov
2009-02-11 16:37           ` Bartlomiej Zolnierkiewicz
2009-02-09 23:20 ` [PATCH 6/6] ide: keep track of number of bytes instead of sectors in struct ide_cmd Bartlomiej Zolnierkiewicz
2009-02-11  7:16 ` [PATCH 0/6] ide: more unifications of ATA and ATAPI support Borislav Petkov
2009-02-23 22:51   ` Bartlomiej Zolnierkiewicz [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=200902232351.17723.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).