diff options
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r-- | drivers/scsi/st.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 7f96f33c1bb1..f0606da19d02 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -3590,12 +3590,11 @@ static struct st_buffer * | |||
3590 | 3590 | ||
3591 | i = sizeof(struct st_buffer) + (max_sg - 1) * sizeof(struct scatterlist) + | 3591 | i = sizeof(struct st_buffer) + (max_sg - 1) * sizeof(struct scatterlist) + |
3592 | max_sg * sizeof(struct st_buf_fragment); | 3592 | max_sg * sizeof(struct st_buf_fragment); |
3593 | tb = kmalloc(i, priority); | 3593 | tb = kzalloc(i, priority); |
3594 | if (!tb) { | 3594 | if (!tb) { |
3595 | printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n"); | 3595 | printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n"); |
3596 | return NULL; | 3596 | return NULL; |
3597 | } | 3597 | } |
3598 | memset(tb, 0, i); | ||
3599 | tb->frp_segs = tb->orig_frp_segs = 0; | 3598 | tb->frp_segs = tb->orig_frp_segs = 0; |
3600 | tb->use_sg = max_sg; | 3599 | tb->use_sg = max_sg; |
3601 | tb->frp = (struct st_buf_fragment *)(&(tb->sg[0]) + max_sg); | 3600 | tb->frp = (struct st_buf_fragment *)(&(tb->sg[0]) + max_sg); |
@@ -3924,14 +3923,13 @@ static int st_probe(struct device *dev) | |||
3924 | goto out_put_disk; | 3923 | goto out_put_disk; |
3925 | } | 3924 | } |
3926 | 3925 | ||
3927 | tmp_da = kmalloc(tmp_dev_max * sizeof(struct scsi_tape *), GFP_ATOMIC); | 3926 | tmp_da = kzalloc(tmp_dev_max * sizeof(struct scsi_tape *), GFP_ATOMIC); |
3928 | if (tmp_da == NULL) { | 3927 | if (tmp_da == NULL) { |
3929 | write_unlock(&st_dev_arr_lock); | 3928 | write_unlock(&st_dev_arr_lock); |
3930 | printk(KERN_ERR "st: Can't extend device array.\n"); | 3929 | printk(KERN_ERR "st: Can't extend device array.\n"); |
3931 | goto out_put_disk; | 3930 | goto out_put_disk; |
3932 | } | 3931 | } |
3933 | 3932 | ||
3934 | memset(tmp_da, 0, tmp_dev_max * sizeof(struct scsi_tape *)); | ||
3935 | if (scsi_tapes != NULL) { | 3933 | if (scsi_tapes != NULL) { |
3936 | memcpy(tmp_da, scsi_tapes, | 3934 | memcpy(tmp_da, scsi_tapes, |
3937 | st_dev_max * sizeof(struct scsi_tape *)); | 3935 | st_dev_max * sizeof(struct scsi_tape *)); |
@@ -3948,13 +3946,12 @@ static int st_probe(struct device *dev) | |||
3948 | if (i >= st_dev_max) | 3946 | if (i >= st_dev_max) |
3949 | panic("scsi_devices corrupt (st)"); | 3947 | panic("scsi_devices corrupt (st)"); |
3950 | 3948 | ||
3951 | tpnt = kmalloc(sizeof(struct scsi_tape), GFP_ATOMIC); | 3949 | tpnt = kzalloc(sizeof(struct scsi_tape), GFP_ATOMIC); |
3952 | if (tpnt == NULL) { | 3950 | if (tpnt == NULL) { |
3953 | write_unlock(&st_dev_arr_lock); | 3951 | write_unlock(&st_dev_arr_lock); |
3954 | printk(KERN_ERR "st: Can't allocate device descriptor.\n"); | 3952 | printk(KERN_ERR "st: Can't allocate device descriptor.\n"); |
3955 | goto out_put_disk; | 3953 | goto out_put_disk; |
3956 | } | 3954 | } |
3957 | memset(tpnt, 0, sizeof(struct scsi_tape)); | ||
3958 | kref_init(&tpnt->kref); | 3955 | kref_init(&tpnt->kref); |
3959 | tpnt->disk = disk; | 3956 | tpnt->disk = disk; |
3960 | sprintf(disk->disk_name, "st%d", i); | 3957 | sprintf(disk->disk_name, "st%d", i); |