[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240825094018.bm5yDW4g@linutronix.de>
Date: Sun, 25 Aug 2024 11:40:18 +0200
From: Nam Cao <namcao@...utronix.de>
To: Riyan Dhiman <riyandhiman14@...il.com>
Cc: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev
Subject: Re: [PATCH] staging: vme_user: Change slot number type from int to
u32
On Sun, Aug 25, 2024 at 02:20:34PM +0530, Riyan Dhiman wrote:
> > Are you sure none of the changed functions ever return a negative error
> > code?
>
> Yes, I have checked all the functions and variables for it.
> the slot function is defined like this
What about vme_slot_num()? It may return -EINVAL, right?
> static u32 tsi148_slot_get(struct vme_bridge *tsi148_bridge)
> {
> u32 slot = 0;
> struct tsi148_driver *bridge;
>
> bridge = tsi148_bridge->driver_priv;
>
> if (!geoid) {
> slot = ioread32be(bridge->base + TSI148_LCSR_VSTAT);
> slot = slot & TSI148_LCSR_VSTAT_GA_M;
> } else {
> slot = geoid;
> }
>
> return slot;
> }
>
> Here, slot is defined as u32, and the value read from ioread32be is also
> u32.
> In the else case, it is assigned to geoid, which is an int global variable.
> This global variable is a module parameter defined as follows:
>
> MODULE_PARM_DESC(geoid, "Override geographical addressing");
> module_param(geoid, int, 0);
>
> which I assume will always be non-negative.
If this should always be non-negative, then perhaps we should prevent users
from specifying negatives values. But that's a separate issue.
Best regards,
Nam
Powered by blists - more mailing lists