@@ -690,7 +690,7 @@ static void twl_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
690
690
newcommand -> request_id__lunl =
691
691
cpu_to_le16 (TW_REQ_LUN_IN (TW_LUN_OUT (newcommand -> request_id__lunl ), request_id ));
692
692
if (length ) {
693
- newcommand -> sg_list [0 ].address = TW_CPU_TO_SGL (dma_handle + sizeof (TW_Ioctl_Buf_Apache ) - 1 );
693
+ newcommand -> sg_list [0 ].address = TW_CPU_TO_SGL (dma_handle + sizeof (TW_Ioctl_Buf_Apache ));
694
694
newcommand -> sg_list [0 ].length = TW_CPU_TO_SGL (length );
695
695
}
696
696
newcommand -> sgl_entries__lunh =
@@ -702,7 +702,7 @@ static void twl_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
702
702
if (TW_SGL_OUT (oldcommand -> opcode__sgloffset )) {
703
703
/* Load the sg list */
704
704
sgl = (TW_SG_Entry_ISO * )((u32 * )oldcommand + oldcommand -> size - (sizeof (TW_SG_Entry_ISO )/4 ) + pae + (sizeof (dma_addr_t ) > 4 ? 1 : 0 ));
705
- sgl -> address = TW_CPU_TO_SGL (dma_handle + sizeof (TW_Ioctl_Buf_Apache ) - 1 );
705
+ sgl -> address = TW_CPU_TO_SGL (dma_handle + sizeof (TW_Ioctl_Buf_Apache ));
706
706
sgl -> length = TW_CPU_TO_SGL (length );
707
707
oldcommand -> size += pae ;
708
708
oldcommand -> size += sizeof (dma_addr_t ) > 4 ? 1 : 0 ;
@@ -748,7 +748,7 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
748
748
data_buffer_length_adjusted = (driver_command .buffer_length + 511 ) & ~511 ;
749
749
750
750
/* Now allocate ioctl buf memory */
751
- cpu_addr = dma_alloc_coherent (& tw_dev -> tw_pci_dev -> dev , data_buffer_length_adjusted + sizeof (TW_Ioctl_Buf_Apache ) - 1 , & dma_handle , GFP_KERNEL );
751
+ cpu_addr = dma_alloc_coherent (& tw_dev -> tw_pci_dev -> dev , data_buffer_length_adjusted + sizeof (TW_Ioctl_Buf_Apache ), & dma_handle , GFP_KERNEL );
752
752
if (!cpu_addr ) {
753
753
retval = - ENOMEM ;
754
754
goto out2 ;
@@ -757,7 +757,7 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
757
757
tw_ioctl = (TW_Ioctl_Buf_Apache * )cpu_addr ;
758
758
759
759
/* Now copy down the entire ioctl */
760
- if (copy_from_user (tw_ioctl , argp , driver_command .buffer_length + sizeof (TW_Ioctl_Buf_Apache ) - 1 ))
760
+ if (copy_from_user (tw_ioctl , argp , driver_command .buffer_length + sizeof (TW_Ioctl_Buf_Apache )))
761
761
goto out3 ;
762
762
763
763
/* See which ioctl we are doing */
@@ -815,11 +815,11 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long
815
815
}
816
816
817
817
/* Now copy the entire response to userspace */
818
- if (copy_to_user (argp , tw_ioctl , sizeof (TW_Ioctl_Buf_Apache ) + driver_command .buffer_length - 1 ) == 0 )
818
+ if (copy_to_user (argp , tw_ioctl , sizeof (TW_Ioctl_Buf_Apache ) + driver_command .buffer_length ) == 0 )
819
819
retval = 0 ;
820
820
out3 :
821
821
/* Now free ioctl buf memory */
822
- dma_free_coherent (& tw_dev -> tw_pci_dev -> dev , data_buffer_length_adjusted + sizeof (TW_Ioctl_Buf_Apache ) - 1 , cpu_addr , dma_handle );
822
+ dma_free_coherent (& tw_dev -> tw_pci_dev -> dev , data_buffer_length_adjusted + sizeof (TW_Ioctl_Buf_Apache ), cpu_addr , dma_handle );
823
823
out2 :
824
824
mutex_unlock (& tw_dev -> ioctl_lock );
825
825
out :
0 commit comments