Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1239006

Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect()

From Luis de Bethencourt <luisbg@osg.samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect()
Date 2015-10-03 23:40 +0200
Message-ID <qfCH8-5Dz-9@gated-at.bofh.it> (permalink)
References <qeml7-1mP-39@gated-at.bofh.it> <qevy1-6hR-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 30/09/15 20:40, Jiri Kosina wrote:
> On Wed, 30 Sep 2015, Luis de Bethencourt wrote:
> 
>> The driver is using -1 instead of the -ENOMEM defined macro to specify
>> that a buffer allocation failed. Since the error number is propagated,
>> the caller will get a -EPERM which is the wrong error condition.
> 
> Generally I agree that the more specific errno, the better.
> 
> But I am not really sure where you are seeing the bug (mapping to -EPERM) 
> in this case? I think the only caller of hiddev_connect() should be 
> hid_connect(), and the only thing that guy cares about whether individual 
> callbacks succeed or fail, so that it sets hdev->clamed flags accordingly.
> 
> Could you please be more specific about the -EPERM mapping you are talking 
> about?
> 
> Thanks,
> 

I agree with you. The only caller of hiddev_connect() only checks if the
callback succeded. It checks if the return < 0.
What I meant is that -1 means -EPERM. [0]

This patch is purely about the correctness of using -ENOMEM. The word
"propagated" was not the best way to describe this problem. I could edit
the commit message if you would like.

Thanks for the review,
Luis

[0] http://lxr.free-electrons.com/source/include/uapi/asm-generic/errno-base.h#L15
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] HID: hiddev: fix returned errno code in hiddev_connect() Luis de Bethencourt <luisbg@osg.samsung.com> - 2015-09-30 12:30 +0200
  Re: [PATCH] HID: hiddev: fix returned errno code in  hiddev_connect() Jiri Kosina <jikos@kernel.org> - 2015-09-30 21:50 +0200
    Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect() Luis de Bethencourt <luisbg@osg.samsung.com> - 2015-10-03 23:40 +0200
      Re: [PATCH] HID: hiddev: fix returned errno code in  hiddev_connect() Jiri Kosina <jikos@kernel.org> - 2015-10-05 16:30 +0200

csiph-web