All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: aacraid: fix -Wcast-function-type
@ 2020-03-07 13:21 Phong Tran
  2020-03-07 16:35 ` Bart Van Assche
  2020-03-08  2:01 ` [PATCH v2] " Phong Tran
  0 siblings, 2 replies; 9+ messages in thread
From: Phong Tran @ 2020-03-07 13:21 UTC (permalink / raw)
  To: aacraid, jejb, martin.petersen
  Cc: linux-scsi, linux-kernel, keescook, Phong Tran

correct usage prototype of callback scsi_cmnd.scsi_done()
Report by: https://github.com/KSPP/linux/issues/20

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
---
 drivers/scsi/aacraid/aachba.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 33dbc051bff9..92a1058df3f5 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)
 	return 0;
 }
 
+static void  aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)
+{
+	aac_probe_container_callback1(scsi_cmnd);
+}
+
 int aac_probe_container(struct aac_dev *dev, int cid)
 {
 	struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)
 		return -ENOMEM;
 	}
 	scsicmd->list.next = NULL;
-	scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))aac_probe_container_callback1;
+	scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_scsi_done;
 
 	scsicmd->device = scsidev;
 	scsidev->sdev_state = 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] scsi: aacraid: fix -Wcast-function-type
  2020-03-07 13:21 [PATCH] scsi: aacraid: fix -Wcast-function-type Phong Tran
@ 2020-03-07 16:35 ` Bart Van Assche
  2020-03-08  2:08   ` Phong Tran
  2020-03-08  2:01 ` [PATCH v2] " Phong Tran
  1 sibling, 1 reply; 9+ messages in thread
From: Bart Van Assche @ 2020-03-07 16:35 UTC (permalink / raw)
  To: Phong Tran, aacraid, jejb, martin.petersen
  Cc: linux-scsi, linux-kernel, keescook

On 2020-03-07 05:21, Phong Tran wrote:
> correct usage prototype of callback scsi_cmnd.scsi_done()
> Report by: https://github.com/KSPP/linux/issues/20
> 
> Signed-off-by: Phong Tran <tranmanphong@gmail.com>
> ---
>  drivers/scsi/aacraid/aachba.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
> index 33dbc051bff9..92a1058df3f5 100644
> --- a/drivers/scsi/aacraid/aachba.c
> +++ b/drivers/scsi/aacraid/aachba.c
> @@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)
>  	return 0;
>  }
>  
> +static void  aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)
> +{
> +	aac_probe_container_callback1(scsi_cmnd);
> +}
> +
>  int aac_probe_container(struct aac_dev *dev, int cid)
>  {
>  	struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
> @@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)
>  		return -ENOMEM;
>  	}
>  	scsicmd->list.next = NULL;
> -	scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))aac_probe_container_callback1;
> +	scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_scsi_done;
>  
>  	scsicmd->device = scsidev;
>  	scsidev->sdev_state = 0;
> 

Since the above cast is not necessary, please remove it.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] scsi: aacraid: fix -Wcast-function-type
  2020-03-07 13:21 [PATCH] scsi: aacraid: fix -Wcast-function-type Phong Tran
  2020-03-07 16:35 ` Bart Van Assche
@ 2020-03-08  2:01 ` Phong Tran
  2020-03-08  2:23   ` Bart Van Assche
  2020-03-09  9:23   ` John Garry
  1 sibling, 2 replies; 9+ messages in thread
From: Phong Tran @ 2020-03-08  2:01 UTC (permalink / raw)
  To: aacraid, jejb, martin.petersen, bvanassche
  Cc: linux-scsi, linux-kernel, keescook, Phong Tran

correct usage prototype of callback scsi_cmnd.scsi_done()
Report by: https://github.com/KSPP/linux/issues/20

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
---
 drivers/scsi/aacraid/aachba.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 33dbc051bff9..20ca3647d211 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)
 	return 0;
 }
 
+static void  aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)
+{
+	aac_probe_container_callback1(scsi_cmnd);
+}
+
 int aac_probe_container(struct aac_dev *dev, int cid)
 {
 	struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)
 		return -ENOMEM;
 	}
 	scsicmd->list.next = NULL;
-	scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))aac_probe_container_callback1;
+	scsicmd->scsi_done = aac_probe_container_scsi_done;
 
 	scsicmd->device = scsidev;
 	scsidev->sdev_state = 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] scsi: aacraid: fix -Wcast-function-type
  2020-03-07 16:35 ` Bart Van Assche
@ 2020-03-08  2:08   ` Phong Tran
  0 siblings, 0 replies; 9+ messages in thread
From: Phong Tran @ 2020-03-08  2:08 UTC (permalink / raw)
  To: Bart Van Assche, aacraid, jejb, martin.petersen
  Cc: tranmanphong, linux-scsi, linux-kernel, keescook



On 3/7/20 11:35 PM, Bart Van Assche wrote:
> On 2020-03-07 05:21, Phong Tran wrote:
>> correct usage prototype of callback scsi_cmnd.scsi_done()
>> Report by: https://github.com/KSPP/linux/issues/20
>>
>> Signed-off-by: Phong Tran <tranmanphong@gmail.com>
>> ---
>>   drivers/scsi/aacraid/aachba.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
>> index 33dbc051bff9..92a1058df3f5 100644
>> --- a/drivers/scsi/aacraid/aachba.c
>> +++ b/drivers/scsi/aacraid/aachba.c
>> @@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)
>>   	return 0;
>>   }
>>   
>> +static void  aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)
>> +{
>> +	aac_probe_container_callback1(scsi_cmnd);
>> +}
>> +
>>   int aac_probe_container(struct aac_dev *dev, int cid)
>>   {
>>   	struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
>> @@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)
>>   		return -ENOMEM;
>>   	}
>>   	scsicmd->list.next = NULL;
>> -	scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))aac_probe_container_callback1;
>> +	scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_scsi_done;
>>   
>>   	scsicmd->device = scsidev;
>>   	scsidev->sdev_state = 0;
>>
> 
> Since the above cast is not necessary, please remove it.
> 

yes, sent v2.

Regards,

Phong.

> Thanks,
> 
> Bart.
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] scsi: aacraid: fix -Wcast-function-type
  2020-03-08  2:01 ` [PATCH v2] " Phong Tran
@ 2020-03-08  2:23   ` Bart Van Assche
  2020-03-09  9:23   ` John Garry
  1 sibling, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2020-03-08  2:23 UTC (permalink / raw)
  To: Phong Tran, aacraid, jejb, martin.petersen
  Cc: linux-scsi, linux-kernel, keescook

On 2020-03-07 18:01, Phong Tran wrote:
> correct usage prototype of callback scsi_cmnd.scsi_done()
> Report by: https://github.com/KSPP/linux/issues/20

This description is confusing. I think a better description would have
been "Make the aacraid driver -Wcast-function-type clean."

Anyway:

Reviewed-by: Bart van Assche <bvanassche@acm.org>





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] scsi: aacraid: fix -Wcast-function-type
  2020-03-08  2:01 ` [PATCH v2] " Phong Tran
  2020-03-08  2:23   ` Bart Van Assche
@ 2020-03-09  9:23   ` John Garry
  2020-03-09 15:53     ` [PATCH v3] scsi: aacraid: cleanup warning cast-function-type Phong Tran
  1 sibling, 1 reply; 9+ messages in thread
From: John Garry @ 2020-03-09  9:23 UTC (permalink / raw)
  To: Phong Tran, aacraid, jejb, martin.petersen, bvanassche
  Cc: linux-scsi, linux-kernel, keescook

On 08/03/2020 02:01, Phong Tran wrote:
> correct usage prototype of callback scsi_cmnd.scsi_done()
> Report by: https://github.com/KSPP/linux/issues/20
> 

no harm to add:

drivers/scsi/aacraid/aachba.c:813:23: warning: cast between incompatible 
function types from ‘int (*)(struct scsi_cmnd *)’ to ‘void (*)(struct 
scsi_cmnd *)’ [-Wcast-function-type]


> Signed-off-by: Phong Tran <tranmanphong@gmail.com>
> ---
>   drivers/scsi/aacraid/aachba.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
> index 33dbc051bff9..20ca3647d211 100644
> --- a/drivers/scsi/aacraid/aachba.c
> +++ b/drivers/scsi/aacraid/aachba.c
> @@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)
>   	return 0;
>   }
>   
> +static void  aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)

supernit: double whitespace

> +{
> +	aac_probe_container_callback1(scsi_cmnd);
> +}
> +
>   int aac_probe_container(struct aac_dev *dev, int cid)
>   {
>   	struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
> @@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)
>   		return -ENOMEM;
>   	}
>   	scsicmd->list.next = NULL;
> -	scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))aac_probe_container_callback1;
> +	scsicmd->scsi_done = aac_probe_container_scsi_done;
>   
>   	scsicmd->device = scsidev;
>   	scsidev->sdev_state = 0;
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3] scsi: aacraid: cleanup warning cast-function-type
  2020-03-09  9:23   ` John Garry
@ 2020-03-09 15:53     ` Phong Tran
  2020-03-09 16:17       ` Kees Cook
  2020-03-11  2:36       ` Martin K. Petersen
  0 siblings, 2 replies; 9+ messages in thread
From: Phong Tran @ 2020-03-09 15:53 UTC (permalink / raw)
  To: john.garry
  Cc: aacraid, bvanassche, jejb, keescook, linux-kernel, linux-scsi,
	martin.petersen, tranmanphong

Make the aacraid driver -Wcast-function-type clean
Report by: https://github.com/KSPP/linux/issues/20

drivers/scsi/aacraid/aachba.c:813:23:
warning: cast between incompatible function types from
'int (*)(struct scsi_cmnd *)' to 'void (*)(struct scsi_cmnd *)'
[-Wcast-function-type]

Reviewed-by: Bart van Assche <bvanassche@acm.org>
Signed-off-by: Phong Tran <tranmanphong@gmail.com>
---
 drivers/scsi/aacraid/aachba.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 33dbc051bff9..ebfb42af67f5 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)
 	return 0;
 }
 
+static void aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)
+{
+	aac_probe_container_callback1(scsi_cmnd);
+}
+
 int aac_probe_container(struct aac_dev *dev, int cid)
 {
 	struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)
 		return -ENOMEM;
 	}
 	scsicmd->list.next = NULL;
-	scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))aac_probe_container_callback1;
+	scsicmd->scsi_done = aac_probe_container_scsi_done;
 
 	scsicmd->device = scsidev;
 	scsidev->sdev_state = 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3] scsi: aacraid: cleanup warning cast-function-type
  2020-03-09 15:53     ` [PATCH v3] scsi: aacraid: cleanup warning cast-function-type Phong Tran
@ 2020-03-09 16:17       ` Kees Cook
  2020-03-11  2:36       ` Martin K. Petersen
  1 sibling, 0 replies; 9+ messages in thread
From: Kees Cook @ 2020-03-09 16:17 UTC (permalink / raw)
  To: Phong Tran
  Cc: john.garry, aacraid, bvanassche, jejb, linux-kernel, linux-scsi,
	martin.petersen

On Mon, Mar 09, 2020 at 10:53:19PM +0700, Phong Tran wrote:
> Make the aacraid driver -Wcast-function-type clean
> Report by: https://github.com/KSPP/linux/issues/20
> 
> drivers/scsi/aacraid/aachba.c:813:23:
> warning: cast between incompatible function types from
> 'int (*)(struct scsi_cmnd *)' to 'void (*)(struct scsi_cmnd *)'
> [-Wcast-function-type]
> 
> Reviewed-by: Bart van Assche <bvanassche@acm.org>
> Signed-off-by: Phong Tran <tranmanphong@gmail.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  drivers/scsi/aacraid/aachba.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
> index 33dbc051bff9..ebfb42af67f5 100644
> --- a/drivers/scsi/aacraid/aachba.c
> +++ b/drivers/scsi/aacraid/aachba.c
> @@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)
>  	return 0;
>  }
>  
> +static void aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)
> +{
> +	aac_probe_container_callback1(scsi_cmnd);
> +}
> +
>  int aac_probe_container(struct aac_dev *dev, int cid)
>  {
>  	struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
> @@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)
>  		return -ENOMEM;
>  	}
>  	scsicmd->list.next = NULL;
> -	scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))aac_probe_container_callback1;
> +	scsicmd->scsi_done = aac_probe_container_scsi_done;
>  
>  	scsicmd->device = scsidev;
>  	scsidev->sdev_state = 0;
> -- 
> 2.20.1
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3] scsi: aacraid: cleanup warning cast-function-type
  2020-03-09 15:53     ` [PATCH v3] scsi: aacraid: cleanup warning cast-function-type Phong Tran
  2020-03-09 16:17       ` Kees Cook
@ 2020-03-11  2:36       ` Martin K. Petersen
  1 sibling, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2020-03-11  2:36 UTC (permalink / raw)
  To: Phong Tran
  Cc: john.garry, aacraid, bvanassche, jejb, keescook, linux-kernel,
	linux-scsi, martin.petersen


Phong,

> Make the aacraid driver -Wcast-function-type clean Report by:
> https://github.com/KSPP/linux/issues/20

Applied to 5.7/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-11  2:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-07 13:21 [PATCH] scsi: aacraid: fix -Wcast-function-type Phong Tran
2020-03-07 16:35 ` Bart Van Assche
2020-03-08  2:08   ` Phong Tran
2020-03-08  2:01 ` [PATCH v2] " Phong Tran
2020-03-08  2:23   ` Bart Van Assche
2020-03-09  9:23   ` John Garry
2020-03-09 15:53     ` [PATCH v3] scsi: aacraid: cleanup warning cast-function-type Phong Tran
2020-03-09 16:17       ` Kees Cook
2020-03-11  2:36       ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.