diff mbox

iwlwifi: mvm: catch underflow error earlier

Message ID 20150821084821.GC25369@mwanda (mailing list archive)
State Accepted
Headers show

Commit Message

Dan Carpenter Aug. 21, 2015, 8:48 a.m. UTC
My static checker complains that we don't check for underflows in
iwl_dbgfs_fw_dbg_conf_write().  This is harmless because we have a
sanity check in iwl_mvm_start_fw_dbg_conf(), but we may as well make
this unsigned and silence the underflow warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

Comments

Emmanuel Grumbach Aug. 22, 2015, 5:25 p.m. UTC | #1
Hi Dan,

On 08/21/2015 11:49 AM, Dan Carpenter wrote:
> My static checker complains that we don't check for underflows in
> iwl_dbgfs_fw_dbg_conf_write().  This is harmless because we have a
> sanity check in iwl_mvm_start_fw_dbg_conf(), but we may as well make
> this unsigned and silence the underflow warning.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 

Applied in our internal tree. Thanks.

> diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
> index ca4a1f8..7d69a55 100644
> --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
> +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
> @@ -949,9 +949,10 @@ static ssize_t iwl_dbgfs_fw_dbg_conf_write(struct iwl_mvm *mvm,
>  					   char *buf, size_t count,
>  					   loff_t *ppos)
>  {
> -	int ret, conf_id;
> +	unsigned int conf_id;
> +	int ret;
>  
> -	ret = kstrtoint(buf, 0, &conf_id);
> +	ret = kstrtouint(buf, 0, &conf_id);
>  	if (ret)
>  		return ret;
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index ca4a1f8..7d69a55 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -949,9 +949,10 @@  static ssize_t iwl_dbgfs_fw_dbg_conf_write(struct iwl_mvm *mvm,
 					   char *buf, size_t count,
 					   loff_t *ppos)
 {
-	int ret, conf_id;
+	unsigned int conf_id;
+	int ret;
 
-	ret = kstrtoint(buf, 0, &conf_id);
+	ret = kstrtouint(buf, 0, &conf_id);
 	if (ret)
 		return ret;