linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] applicom: fix some err codes returned by ac_ioctl
@ 2021-03-24  7:20 Xu Jia
  2021-03-24 12:03 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Xu Jia @ 2021-03-24  7:20 UTC (permalink / raw)
  To: gregkh, arnd; +Cc: linux-kernel

When cmd > 6 or copy_to_user() fail, The variable 'ret' would not be 
returned back. Fix the 'ret' set but not used.

Signed-off-by: Xu Jia <xujia39@huawei.com>
---
 drivers/char/applicom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 14b2d8034c51..0ab765143354 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -839,7 +839,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	Dummy = readb(apbs[IndexCard].RamIO + VERS);
 	kfree(adgl);
 	mutex_unlock(&ac_mutex);
-	return 0;
+	return ret;
 
 err:
 	if (warncount) {
-- 
2.25.1


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

* Re: [PATCH -next] applicom: fix some err codes returned by ac_ioctl
  2021-03-24  7:20 [PATCH -next] applicom: fix some err codes returned by ac_ioctl Xu Jia
@ 2021-03-24 12:03 ` Arnd Bergmann
  2021-03-28 12:51   ` gregkh
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2021-03-24 12:03 UTC (permalink / raw)
  To: Xu Jia; +Cc: gregkh, Linux Kernel Mailing List, David Woodhouse

On Wed, Mar 24, 2021 at 8:20 AM Xu Jia <xujia39@huawei.com> wrote:
>
> When cmd > 6 or copy_to_user() fail, The variable 'ret' would not be
> returned back. Fix the 'ret' set but not used.
>
> Signed-off-by: Xu Jia <xujia39@huawei.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

> diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
> index 14b2d8034c51..0ab765143354 100644
> --- a/drivers/char/applicom.c
> +++ b/drivers/char/applicom.c
> @@ -839,7 +839,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>         Dummy = readb(apbs[IndexCard].RamIO + VERS);
>         kfree(adgl);
>         mutex_unlock(&ac_mutex);
> -       return 0;
> +       return ret;
>

Apparently this has been broken since the driver was first merged in
linux-2.3.16. I could find no indication of anyone using the driver
and reporting any problems in the git history and it clearly still has
the style of drivers writting in the 1990s. On the other hand, this is
(was) used in some very long-lived systems and you can still
buy old applicom cards from artisan[1].

Is there any chance this driver is still used anywhere with modern
kernels? I suspect we could move it to staging to find out.

      Arnd

[1] https://www.artisantg.com/Mfgr/MolexWoodheadApplicom

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

* Re: [PATCH -next] applicom: fix some err codes returned by ac_ioctl
  2021-03-24 12:03 ` Arnd Bergmann
@ 2021-03-28 12:51   ` gregkh
  0 siblings, 0 replies; 3+ messages in thread
From: gregkh @ 2021-03-28 12:51 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Xu Jia, Linux Kernel Mailing List, David Woodhouse

On Wed, Mar 24, 2021 at 01:03:50PM +0100, Arnd Bergmann wrote:
> On Wed, Mar 24, 2021 at 8:20 AM Xu Jia <xujia39@huawei.com> wrote:
> >
> > When cmd > 6 or copy_to_user() fail, The variable 'ret' would not be
> > returned back. Fix the 'ret' set but not used.
> >
> > Signed-off-by: Xu Jia <xujia39@huawei.com>
> 
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> 
> > diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
> > index 14b2d8034c51..0ab765143354 100644
> > --- a/drivers/char/applicom.c
> > +++ b/drivers/char/applicom.c
> > @@ -839,7 +839,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> >         Dummy = readb(apbs[IndexCard].RamIO + VERS);
> >         kfree(adgl);
> >         mutex_unlock(&ac_mutex);
> > -       return 0;
> > +       return ret;
> >
> 
> Apparently this has been broken since the driver was first merged in
> linux-2.3.16. I could find no indication of anyone using the driver
> and reporting any problems in the git history and it clearly still has
> the style of drivers writting in the 1990s. On the other hand, this is
> (was) used in some very long-lived systems and you can still
> buy old applicom cards from artisan[1].
> 
> Is there any chance this driver is still used anywhere with modern
> kernels? I suspect we could move it to staging to find out.

No objection from me to move it to staging, want to send a patch or I
can.

thanks,

greg k-h

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

end of thread, other threads:[~2021-03-28 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24  7:20 [PATCH -next] applicom: fix some err codes returned by ac_ioctl Xu Jia
2021-03-24 12:03 ` Arnd Bergmann
2021-03-28 12:51   ` gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).