All of lore.kernel.org
 help / color / mirror / Atom feed
* [smb3] unreachable code and memory leaks
@ 2018-06-18 13:07 Gustavo A. R. Silva
  2018-06-18 16:55 ` Steve French
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2018-06-18 13:07 UTC (permalink / raw)
  To: Steve French
  Cc: linux-cifs, samba-technical, linux-kernel, Gustavo A. R. Silva

Hi Steve,

While doing some static analysis I came across the following piece of code at fs/cifs/smb2pdu.c:2017:

2017                if (n_iov > 2) {
2018                        struct create_context *ccontext =
2019                            (struct create_context *)iov[n_iov-1].iov_base;
2020                        ccontext->Next =
2021                                cpu_to_le32(iov[n_iov-1].iov_len);
2022                }

The code above is unreachable because n_iov is initialized to 2 and, its value is never updated.
I'm not sure how to fix this.

Also, it seems there are multiple places in which memory allocated for *path* is leaking:

1946        else
1947                return -EIO;

1951        if (rc)
1952                return rc;

1987                if (rc) {
1988                        cifs_small_buf_release(req);
1989                        return rc;
1990                }

and more...

Thanks
--
Gustavo

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

end of thread, other threads:[~2018-06-19  1:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 13:07 [smb3] unreachable code and memory leaks Gustavo A. R. Silva
2018-06-18 16:55 ` Steve French
2018-06-18 17:18   ` Steve French
2018-06-18 17:34     ` Gustavo A. R. Silva
2018-06-19  1:20       ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.