LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH][next] ksmbd: add missing assignments to ret on ndr_read_int64 read calls
@ 2021-09-06 13:44 Colin King
2021-09-06 23:31 ` Namjae Jeon
2021-09-07 0:08 ` Sergey Senozhatsky
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2021-09-06 13:44 UTC (permalink / raw)
To: Namjae Jeon, Sergey Senozhatsky, Steve French, Hyunchul Lee, linux-cifs
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently there are two ndr_read_int64 calls where ret is being checked
for failure but ret is not being assigned a return value from the call.
Static analyis is reporting the checks on ret as dead code. Fix this.
Addresses-Coverity: ("Logical dead code")
Fixes: 303fff2b8c77 ("ksmbd: add validation for ndr read/write functions")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/ksmbd/ndr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ksmbd/ndr.c b/fs/ksmbd/ndr.c
index a476de291f62..8317f7ca402b 100644
--- a/fs/ksmbd/ndr.c
+++ b/fs/ksmbd/ndr.c
@@ -275,11 +275,11 @@ int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da)
if (ret)
return ret;
- ndr_read_int64(n, NULL);
+ ret = ndr_read_int64(n, NULL);
if (ret)
return ret;
- ndr_read_int64(n, NULL);
+ ret = ndr_read_int64(n, NULL);
if (ret)
return ret;
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] ksmbd: add missing assignments to ret on ndr_read_int64 read calls
2021-09-06 13:44 [PATCH][next] ksmbd: add missing assignments to ret on ndr_read_int64 read calls Colin King
@ 2021-09-06 23:31 ` Namjae Jeon
2021-09-07 0:08 ` Sergey Senozhatsky
1 sibling, 0 replies; 3+ messages in thread
From: Namjae Jeon @ 2021-09-06 23:31 UTC (permalink / raw)
To: Colin King
Cc: Sergey Senozhatsky, Steve French, Hyunchul Lee, linux-cifs,
kernel-janitors, linux-kernel
2021-09-06 22:44 GMT+09:00, Colin King <colin.king@canonical.com>:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently there are two ndr_read_int64 calls where ret is being checked
> for failure but ret is not being assigned a return value from the call.
> Static analyis is reporting the checks on ret as dead code. Fix this.
>
> Addresses-Coverity: ("Logical dead code")
> Fixes: 303fff2b8c77 ("ksmbd: add validation for ndr read/write functions")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied it to my queue. I will send it to Steve after testing.
Thanks for your patch!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] ksmbd: add missing assignments to ret on ndr_read_int64 read calls
2021-09-06 13:44 [PATCH][next] ksmbd: add missing assignments to ret on ndr_read_int64 read calls Colin King
2021-09-06 23:31 ` Namjae Jeon
@ 2021-09-07 0:08 ` Sergey Senozhatsky
1 sibling, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2021-09-07 0:08 UTC (permalink / raw)
To: Colin King
Cc: Namjae Jeon, Sergey Senozhatsky, Steve French, Hyunchul Lee,
linux-cifs, kernel-janitors, linux-kernel
On (21/09/06 14:44), Colin King wrote:
[..]
> @@ -275,11 +275,11 @@ int ndr_decode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da)
> if (ret)
> return ret;
>
> - ndr_read_int64(n, NULL);
> + ret = ndr_read_int64(n, NULL);
> if (ret)
> return ret;
>
> - ndr_read_int64(n, NULL);
> + ret = ndr_read_int64(n, NULL);
> if (ret)
> return ret;
A pretty nice catch by that static analyzer tool.
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-07 0:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 13:44 [PATCH][next] ksmbd: add missing assignments to ret on ndr_read_int64 read calls Colin King
2021-09-06 23:31 ` Namjae Jeon
2021-09-07 0:08 ` Sergey Senozhatsky
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).