dma_unmap_single(hostdata->dev, slot->dma_handle, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
                        /* restore the old result if the request sense was
                         * successful */
-                       if(result == 0)
+                       if (result == 0)
                                result = cmnd[7];
+                       /* restore the original length */
+                       SCp->cmd_len = cmnd[8];
                } else
                        NCR_700_unmap(hostdata, SCp, slot);
 
                                 * of the command */
                                cmnd[6] = NCR_700_INTERNAL_SENSE_MAGIC;
                                cmnd[7] = hostdata->status[0];
+                               cmnd[8] = SCp->cmd_len;
+                               SCp->cmd_len = 6; /* command length for
+                                                  * REQUEST_SENSE */
                                slot->pCmd = dma_map_single(hostdata->dev, cmnd, MAX_COMMAND_SIZE, DMA_TO_DEVICE);
                                slot->dma_handle = dma_map_single(hostdata->dev, SCp->sense_buffer, sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
                                slot->SG[0].ins = bS_to_host(SCRIPT_MOVE_DATA_IN | sizeof(SCp->sense_buffer));