[06/21] cifs: remove rfc1002 hardcoded constants from cifs_discard_remaining_data()

Message ID 20180409080646.23621-7-lsahlber@redhat.com
State New
Headers show
Series
  • cifs: compounding series
Related show

Commit Message

Ronnie Sahlberg April 9, 2018, 8:06 a.m.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/cifssmb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Pavel Shilovsky April 12, 2018, 10:22 p.m. | #1
2018-04-09 1:06 GMT-07:00 Ronnie Sahlberg <lsahlber@redhat.com>:
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/cifssmb.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index 991e9d9ef90a..ae43a28947ab 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -1416,8 +1416,9 @@ CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms, int *oplock,
>  int
>  cifs_discard_remaining_data(struct TCP_Server_Info *server)
>  {
> -       unsigned int rfclen = get_rfc1002_length(server->smallbuf);
> -       int remaining = rfclen + 4 - server->total_read;
> +       unsigned int rfclen = server->pdu_size;
> +       int remaining = rfclen + server->vals->header_preamble_size -
> +               server->total_read;
>
>         while (remaining > 0) {
>                 int length;
> --
> 2.13.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 991e9d9ef90a..ae43a28947ab 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1416,8 +1416,9 @@  CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms, int *oplock,
 int
 cifs_discard_remaining_data(struct TCP_Server_Info *server)
 {
-	unsigned int rfclen = get_rfc1002_length(server->smallbuf);
-	int remaining = rfclen + 4 - server->total_read;
+	unsigned int rfclen = server->pdu_size;
+	int remaining = rfclen + server->vals->header_preamble_size -
+		server->total_read;
 
 	while (remaining > 0) {
 		int length;