public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Sergey Shtylyov <s.shtylyov@omp.ru>, linux-ide@vger.kernel.org
Subject: Re: [PATCH] ata: libata-core: fix sloppy parameter type in ata_exec_internal[_sg]()
Date: Tue, 14 Jun 2022 14:24:32 +0900	[thread overview]
Message-ID: <de30104b-f299-ab7e-c687-06ca513aa7a7@opensource.wdc.com> (raw)
In-Reply-To: <226fc2b1-ecb9-19d9-d7f0-2c6bc0fc8edf@omp.ru>

On 6/14/22 03:47, Sergey Shtylyov wrote:
> Make the 'timeout' parameter to ata_exec_internal_sg() *unsigned int* as
> msecs_to_jiffies() that it calls takes just *unsigned int* for the time in
> milliseconds. Then follow the suit with ata_exec_internal(), its only
> caller; also fix up ata_dev_set_feature(), the only ata_exec_internal()'s
> caller  that explicitly passes *unsigned long* variable for timeout...
> 
> Found by Linux Verification Center (linuxtesting.org) with the SVACE static
> analysis tool.

Since you are changing this function signature, can you also make it
static since it is only used in libata-core.c ? The declaration in
drivers/ata/libata.h is useless.

> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
> This patch is against the 'for-next' branch of Damien's 'libata.git' repo.
> 
>  drivers/ata/libata-core.c |    6 +++---
>  drivers/ata/libata.h      |    4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> Index: libata/drivers/ata/libata-core.c
> ===================================================================
> --- libata.orig/drivers/ata/libata-core.c
> +++ libata/drivers/ata/libata-core.c
> @@ -1472,7 +1472,7 @@ static void ata_qc_complete_internal(str
>  unsigned ata_exec_internal_sg(struct ata_device *dev,
>  			      struct ata_taskfile *tf, const u8 *cdb,
>  			      int dma_dir, struct scatterlist *sgl,
> -			      unsigned int n_elem, unsigned long timeout)
> +			      unsigned int n_elem, unsigned int timeout)
>  {
>  	struct ata_link *link = dev->link;
>  	struct ata_port *ap = link->ap;
> @@ -1647,7 +1647,7 @@ unsigned ata_exec_internal_sg(struct ata
>  unsigned ata_exec_internal(struct ata_device *dev,
>  			   struct ata_taskfile *tf, const u8 *cdb,
>  			   int dma_dir, void *buf, unsigned int buflen,
> -			   unsigned long timeout)
> +			   unsigned int timeout)
>  {
>  	struct scatterlist *psg = NULL, sg;
>  	unsigned int n_elem = 0;
> @@ -4339,7 +4339,7 @@ unsigned int ata_dev_set_feature(struct
>  {
>  	struct ata_taskfile tf;
>  	unsigned int err_mask;
> -	unsigned long timeout = 0;
> +	unsigned int timeout = 0;
>  
>  	/* set up set-features taskfile */
>  	ata_dev_dbg(dev, "set features - SATA features\n");
> Index: libata/drivers/ata/libata.h
> ===================================================================
> --- libata.orig/drivers/ata/libata.h
> +++ libata/drivers/ata/libata.h
> @@ -52,11 +52,11 @@ extern u64 ata_tf_read_block(const struc
>  extern unsigned ata_exec_internal(struct ata_device *dev,
>  				  struct ata_taskfile *tf, const u8 *cdb,
>  				  int dma_dir, void *buf, unsigned int buflen,
> -				  unsigned long timeout);
> +				  unsigned int timeout);
>  extern unsigned ata_exec_internal_sg(struct ata_device *dev,
>  				     struct ata_taskfile *tf, const u8 *cdb,
>  				     int dma_dir, struct scatterlist *sg,
> -				     unsigned int n_elem, unsigned long timeout);
> +				     unsigned int n_elem, unsigned int timeout);
>  extern int ata_wait_ready(struct ata_link *link, unsigned long deadline,
>  			  int (*check_ready)(struct ata_link *link));
>  extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2022-06-14  5:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 18:47 [PATCH] ata: libata-core: fix sloppy parameter type in ata_exec_internal[_sg]() Sergey Shtylyov
2022-06-14  5:24 ` Damien Le Moal [this message]
2022-06-14 18:43   ` Sergey Shtylyov
2022-06-14 23:46     ` [PATCH] ata: libata-core: [_sg]fix sloppy parameter type in ata_exec_internal() Damien Le Moal
2022-06-15 17:09       ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=de30104b-f299-ab7e-c687-06ca513aa7a7@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=s.shtylyov@omp.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox