aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/st.c8
-rw-r--r--drivers/scsi/st.h1
2 files changed, 2 insertions, 7 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 1cfd217f8904..f934016f640c 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3744,7 +3744,7 @@ static long st_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
3744static struct st_buffer * 3744static struct st_buffer *
3745 new_tape_buffer(int from_initialization, int need_dma, int max_sg) 3745 new_tape_buffer(int from_initialization, int need_dma, int max_sg)
3746{ 3746{
3747 int i, got = 0; 3747 int got = 0;
3748 gfp_t priority; 3748 gfp_t priority;
3749 struct st_buffer *tb; 3749 struct st_buffer *tb;
3750 3750
@@ -3753,10 +3753,7 @@ static struct st_buffer *
3753 else 3753 else
3754 priority = GFP_KERNEL; 3754 priority = GFP_KERNEL;
3755 3755
3756 i = sizeof(struct st_buffer) + 3756 tb = kzalloc(sizeof(struct st_buffer), priority);
3757 (max_sg - 1) * sizeof(struct scatterlist);
3758
3759 tb = kzalloc(i, priority);
3760 if (!tb) { 3757 if (!tb) {
3761 printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n"); 3758 printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
3762 return NULL; 3759 return NULL;
@@ -3766,7 +3763,6 @@ static struct st_buffer *
3766 3763
3767 tb->dma = need_dma; 3764 tb->dma = need_dma;
3768 tb->buffer_size = got; 3765 tb->buffer_size = got;
3769 sg_init_table(tb->sg, max_sg);
3770 3766
3771 tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *), priority); 3767 tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *), priority);
3772 if (!tb->reserved_pages) { 3768 if (!tb->reserved_pages) {
diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h
index cc46f18762b7..d29760776f42 100644
--- a/drivers/scsi/st.h
+++ b/drivers/scsi/st.h
@@ -54,7 +54,6 @@ struct st_buffer {
54 unsigned short orig_frp_segs; /* number of segments allocated at first try */ 54 unsigned short orig_frp_segs; /* number of segments allocated at first try */
55 unsigned short frp_segs; /* number of buffer segments */ 55 unsigned short frp_segs; /* number of buffer segments */
56 unsigned int frp_sg_current; /* driver buffer length currently in s/g list */ 56 unsigned int frp_sg_current; /* driver buffer length currently in s/g list */
57 struct scatterlist sg[1]; /* MUST BE last item */
58}; 57};
59 58
60/* The tape mode definition */ 59/* The tape mode definition */