]>
Commit | Line | Data |
---|---|---|
ca940317 GKH |
1 | From a24e2d7d8f512340991ef0a59cb5d08d491b8e98 Mon Sep 17 00:00:00 2001 |
2 | From: Steve French <sfrench@us.ibm.com> | |
3 | Date: Sat, 3 Apr 2010 17:20:21 +0000 | |
4 | Subject: CIFS: initialize nbytes at the beginning of CIFSSMBWrite() | |
5 | ||
6 | From: Steve French <sfrench@us.ibm.com> | |
7 | ||
8 | commit a24e2d7d8f512340991ef0a59cb5d08d491b8e98 upstream. | |
9 | ||
10 | By doing this we always overwrite nbytes value that is being passed on to | |
11 | CIFSSMBWrite() and need not rely on the callers to initialize. CIFSSMBWrite2 is | |
12 | doing this already. | |
13 | ||
14 | Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> | |
15 | Reviewed-by: Jeff Layton <jlayton@samba.org> | |
16 | Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> | |
17 | Signed-off-by: Steve French <sfrench@us.ibm.com> | |
18 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
19 | ||
20 | --- | |
21 | fs/cifs/cifssmb.c | 3 ++- | |
22 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
23 | ||
24 | --- a/fs/cifs/cifssmb.c | |
25 | +++ b/fs/cifs/cifssmb.c | |
26 | @@ -1430,6 +1430,8 @@ CIFSSMBWrite(const int xid, struct cifsT | |
27 | __u32 bytes_sent; | |
28 | __u16 byte_count; | |
29 | ||
30 | + *nbytes = 0; | |
31 | + | |
32 | /* cFYI(1, ("write at %lld %d bytes", offset, count));*/ | |
33 | if (tcon->ses == NULL) | |
34 | return -ECONNABORTED; | |
35 | @@ -1512,7 +1514,6 @@ CIFSSMBWrite(const int xid, struct cifsT | |
36 | cifs_stats_inc(&tcon->num_writes); | |
37 | if (rc) { | |
38 | cFYI(1, ("Send error in write = %d", rc)); | |
39 | - *nbytes = 0; | |
40 | } else { | |
41 | *nbytes = le16_to_cpu(pSMBr->CountHigh); | |
42 | *nbytes = (*nbytes) << 16; |