[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tyndur-devel] [PATCH v2 11/24] ata: Temporary buffer for ATAPI commands



On Sun, Dec 13, 2015 at 01:10:56AM +0100, Max Reitz wrote:
> ! ATAPI commands need to be of size 12. However, general SCSI packets
>   may have any length and thus the SCSI command to be sent has to be
>   copied to a temporary buffer before it can be passed to the ATAPI
>   device.
> 
> Signed-off-by: Max Reitz <max@xxxxxxxxxx>
> Acked-by: Kevin Wolf <kevin@xxxxxxxxxx>
> ---
>  src/modules/cdi/ata/atapi.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/cdi/ata/atapi.c b/src/modules/cdi/ata/atapi.c
> index 31c7263..78f7f29 100644
> --- a/src/modules/cdi/ata/atapi.c
> +++ b/src/modules/cdi/ata/atapi.c
> @@ -28,6 +28,7 @@
>  
>  #include <stdio.h>
>  #include <stdlib.h>
> +#include <string.h>
>  
>  #include "cdi.h"
>  #include "cdi/storage.h"
> @@ -92,6 +93,12 @@ void atapi_remove_device(struct cdi_device* device)
>  
>  int atapi_request(struct cdi_scsi_device* scsi,struct cdi_scsi_packet* packet)
>  {
> +    uint8_t atapi_request[12];
> +    if (packet->cmdsize > 12) {
> +        return -1;
> +    }
> +    memcpy(atapi_request, packet->command, sizeof(atapi_request));

Das ist nicht die neueste Version des Patchs, die du ins CDI-Repo
gepusht hast (und die alte hatte mein Acked-by nicht, obwohl es oben
steht).

Kevin