Skip to contentSkip to conversation

CIFS: Fix variable types in cifs_iovec_read/write

PATCH In review Pavel Shilovsky 1 participant 2 messages Jan 31, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CIFS: Fix variable types in cifs_iovec_read/write

Variable 'i' should be unsigned long as it's used in circle with num_pages, and bytes_read/total_written should be ssize_t according to return value.

---
 fs/cifs/file.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
fs/cifs/file.c +5 -4
index 74c0a28..1b5e01f 100644
@@ -1662,10 +1662,10 @@ static ssize_t
 cifs_iovec_write(struct file *file, const struct iovec *iov,
 		 unsigned long nr_segs, loff_t *poffset)
 {
+	unsigned int written;
+	unsigned long num_pages, npages, i;
+	size_t copied, len, cur_len;
 	size_t total_written = 0;
-	unsigned int written = 0;
-	unsigned long num_pages, npages;
-	size_t copied, len, cur_len, i;
 	struct kvec *to_send;
 	struct page **pages;
 	struct iov_iter it;
@@ -1821,7 +1821,8 @@ cifs_iovec_read(struct file *file, const struct iovec *iov,
 {
 	int rc;
 	int xid;
-	unsigned int total_read, bytes_read = 0;
+	ssize_t total_read;
+	unsigned int bytes_read = 0;
 	size_t len, cur_len;
 	int iov_offset = 0;
 	struct cifs_sb_info *cifs_sb;
Signature · 1 line
1.7.1

A message that is not in the archive (sent off-list or not yet received): 1296478671-22224-1-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org

#2 lore raw

let's drop this one.

2011/1/31 Pavel Shilovsky <[email protected]>:

Quoted 40 lines

Variable 'i' should be unsigned long as it's used in circle with num_pages, and bytes_read/total_written should be ssize_t according to return value.

---
 fs/cifs/file.c |    9 +++++----

 1 files changed, 5 insertions(+), 4 deletions(-)
fs/cifs/file.c +5 -5
index 74c0a28..1b5e01f 100644
@@ -1662,10 +1662,10 @@ static ssize_t
  cifs_iovec_write(struct file *file, const struct iovec *iov,
                 unsigned long nr_segs, loff_t *poffset)
  {
+       unsigned int written;
+       unsigned long num_pages, npages, i;
+       size_t copied, len, cur_len;
        size_t total_written = 0;
-       unsigned int written = 0;
-       unsigned long num_pages, npages;
-       size_t copied, len, cur_len, i;
        struct kvec *to_send;
        struct page **pages;
        struct iov_iter it;
@@ -1821,7 +1821,8 @@ cifs_iovec_read(struct file *file, const struct iovec *iov,
  {
        int rc;
        int xid;
-       unsigned int total_read, bytes_read = 0;
+       ssize_t total_read;
+       unsigned int bytes_read = 0;
        size_t len, cur_len;
        int iov_offset = 0;
        struct cifs_sb_info *cifs_sb;
--

1.7.1

Signature · 2 lines
Best regards,
Pavel Shilovsky.