OSDN Git Service

iwlwifi: mvm: use ssize_t for len in iwl_debugfs_mem_read()
authorLuca Coelho <luciano.coelho@intel.com>
Wed, 28 Sep 2016 08:32:35 +0000 (11:32 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 19 Oct 2016 05:40:35 +0000 (08:40 +0300)
In iwl_dbgfs_mem_read(), the len variable may become negative and is
compared to < 0 (an error case).  Comparing size_t (which is unsigned)
to < 0 causes a warning on certain platforms (like i386):

drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c:1561:5-8: WARNING: Unsigned expression compared with zero: len < 0

To prevent that, use ssize_t for len instead.

Fixes: commit 2b55f43f8e47 ("iwlwifi: mvm: Add mem debugfs entry")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c

index 539d718..06805a6 100644 (file)
@@ -1529,8 +1529,8 @@ static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,
                .data = { &cmd, },
                .len = { sizeof(cmd) },
        };
-       size_t delta, len;
-       ssize_t ret;
+       size_t delta;
+       ssize_t ret, len;
 
        hcmd.id = iwl_cmd_id(*ppos >> 24 ? UMAC_RD_WR : LMAC_RD_WR,
                             DEBUG_GROUP, 0);