Re: [PATCH v2 net] nfp: cast sizeof() to int when comparing with error code
From: David Miller <davem@davemloft.net>
Date: 2018-06-27 06:40:29
From: David Miller <davem@davemloft.net>
Date: 2018-06-27 06:40:29
From: Chengguang Xu <redacted> Date: Tue, 26 Jun 2018 09:16:31 +0800
sizeof() will return unsigned value so in the error check
negative error code will be always larger than sizeof().
Fixes: a0d8e02c35ff ("nfp: add support for reading nffw info")
Signed-off-by: Chengguang Xu <redacted>
Acked-by: Jakub Kicinski <redacted>
---
v2:
- Add more information to patch subject and commit log.I guess the: if (x < 0 || x < sizeof(foo)) better self-documents the situation, but this patch is fine too so I have applied it. Thanks.