2022-04-30 03:27:28

by Shubhrajyoti Datta

[permalink] [raw]
Subject: [PATCH 5/7] tty: xilinx_uartps: Make the timeout unsigned

The timeout cannot be negative make it unsigned.
Also the same for the trigger level.

Addresses-Coverity: Event incompatible_param.
Signed-off-by: Shubhrajyoti Datta <[email protected]>
---
drivers/tty/serial/xilinx_uartps.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index bf0415f0a194..289d70914956 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -34,12 +34,12 @@
#define TX_TIMEOUT 500000

/* Rx Trigger level */
-static int rx_trigger_level = 56;
+static uint rx_trigger_level = 56;
module_param(rx_trigger_level, uint, 0444);
MODULE_PARM_DESC(rx_trigger_level, "Rx trigger level, 1-63 bytes");

/* Rx Timeout */
-static int rx_timeout = 10;
+static uint rx_timeout = 10;
module_param(rx_timeout, uint, 0444);
MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");

--
2.25.1


2022-05-09 04:39:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5/7] tty: xilinx_uartps: Make the timeout unsigned

On Fri, Apr 29, 2022 at 01:44:20PM +0530, Shubhrajyoti Datta wrote:
> The timeout cannot be negative make it unsigned.
> Also the same for the trigger level.
>
> Addresses-Coverity: Event incompatible_param.

What does this mean?

> Signed-off-by: Shubhrajyoti Datta <[email protected]>
> ---
> drivers/tty/serial/xilinx_uartps.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> index bf0415f0a194..289d70914956 100644
> --- a/drivers/tty/serial/xilinx_uartps.c
> +++ b/drivers/tty/serial/xilinx_uartps.c
> @@ -34,12 +34,12 @@
> #define TX_TIMEOUT 500000
>
> /* Rx Trigger level */
> -static int rx_trigger_level = 56;
> +static uint rx_trigger_level = 56;
> module_param(rx_trigger_level, uint, 0444);
> MODULE_PARM_DESC(rx_trigger_level, "Rx trigger level, 1-63 bytes");
>
> /* Rx Timeout */
> -static int rx_timeout = 10;
> +static uint rx_timeout = 10;
> module_param(rx_timeout, uint, 0444);
> MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");

As this is bounded (right?) why is this an issue?

Shouldn't it be a "byte" instead?

thanks,

greg k-h