Re: [PATCH 1/2] Input: atmel_mxt_ts - add wakeup support

2019-05-18 Thread stefano . manni
Hi Dmitry,

On Fri, 2019-05-17 at 14:30 -0700, Dmitry Torokhov wrote:
> Hi Sefano,
> 
> On Fri, May 17, 2019 at 11:17:40PM +0200, Stefano Manni wrote:
> > Add wakeup support to the maxtouch driver.
> > The device can wake up the system from suspend,
> > mark the IRQ as wakeup capable, so that device
> > irq is not disabled during system suspend.
> 
> This should already be handled by I2C core, see lines after "if
> (client->flags & I2C_CLIENT_WAKE)" in drivers/i2c/i2c-core-base.c.
> 
> Unless there is dedicated wakeup interrupt we configure main
> interrupt
> as wake source.
> 

what's about the other drivers (e.g. ili210x.c) doing like this?
Shall they be purged?

Thank you.



[PATCH 1/2] Input: atmel_mxt_ts - add wakeup support

2019-05-17 Thread Stefano Manni
Add wakeup support to the maxtouch driver.
The device can wake up the system from suspend,
mark the IRQ as wakeup capable, so that device
irq is not disabled during system suspend.

Signed-off-by: Stefano Manni 
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c 
b/drivers/input/touchscreen/atmel_mxt_ts.c
index 5c63d25ce84e..2e0abc0b665d 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -3041,6 +3041,7 @@ static const struct dmi_system_id 
chromebook_T9_suspend_dmi[] = {
 static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
struct mxt_data *data;
+   struct device_node *node = client->dev.of_node;
int error;
 
/*
@@ -3125,6 +3126,12 @@ static int mxt_probe(struct i2c_client *client, const 
struct i2c_device_id *id)
goto err_free_object;
}
 
+   if (node) {
+   if (of_property_read_bool(node, "wakeup-source") ||
+   of_property_read_bool(node, "linux,wakeup"))
+   device_init_wakeup(>dev, true);
+   }
+
return 0;
 
 err_free_object:
@@ -3156,6 +3163,9 @@ static int __maybe_unused mxt_suspend(struct device *dev)
 
mutex_lock(_dev->mutex);
 
+   if (device_may_wakeup(>dev))
+   enable_irq_wake(client->irq);
+
if (input_dev->users)
mxt_stop(data);
 
@@ -3175,6 +3185,9 @@ static int __maybe_unused mxt_resume(struct device *dev)
 
mutex_lock(_dev->mutex);
 
+   if (device_may_wakeup(>dev))
+   disable_irq_wake(client->irq);
+
if (input_dev->users)
mxt_start(data);
 
-- 
2.20.1



[PATCH 2/2] dt-bindings: input: Add wakeup-source for atmel,maxtouch

2019-05-17 Thread Stefano Manni
Add wakeup support to the maxtouch driver.

Signed-off-by: Stefano Manni 
---
 Documentation/devicetree/bindings/input/atmel,maxtouch.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt 
b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
index c88919480d37..7491a8843c85 100644
--- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
@@ -31,6 +31,10 @@ Optional properties for main touchpad device:
 
 - reset-gpios: GPIO specifier for the touchscreen's reset pin (active low)
 
+- wakeup-source: use any event on touchscreen as wakeup event.
+(Legacy property support: "linux,wakeup")
+
+
 Example:
 
touch@4b {
@@ -38,4 +42,5 @@ Example:
reg = <0x4b>;
interrupt-parent = <>;
interrupts = ;
+   wakeup-source;
};
-- 
2.20.1



Re: [PATCH] rtc: mcp795: remove VLA usage

2018-03-13 Thread Stefano Manni
Hi,

2018-03-13 0:31 GMT+01:00 Alexandre Belloni
<alexandre.bell...@free-electrons.com>:
> Hi,
>
> On 13/03/2018 at 00:13:38 +0100, Stefano Manni wrote:
>> In preparation to enabling -Wvla, remove VLAs and replace them with
>> fixed-length arrays instead.
>>
>> rtc-mcp795.c uses a variable-length array declaration to contain
>> the command to write the rtcc; this can be replaced by a fixed-
>> size array of length 2 (instruction, address) + 32 (data out),
>> assuming a maximum data length of 32 bytes before wrap up.
>>
>> This was prompted by https://lkml.org/lkml/2018/3/7/621
>>
>> Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
>> ---
>>  drivers/rtc/rtc-mcp795.c | 8 +++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c
>> index 77f21331ae21..a5f504e2364c 100644
>> --- a/drivers/rtc/rtc-mcp795.c
>> +++ b/drivers/rtc/rtc-mcp795.c
>> @@ -61,6 +61,9 @@
>>
>>  #define SEC_PER_DAY  (24 * 60 * 60)
>>
>> +/* Maximum length for data out in write operation to RTCC */
>> +#define MCP795_MAX_DATAOUT_LEN   32
>> +
>
> This is wrong, see https://marc.info/?l=linux-kernel=152046370320811=2
>
> Also, 
> https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next=74ce1a932504da166cfbccf5567aa3751b6aa599
>

You sure that the right value to use is 255 + 2? mcp795_rtcc_write() just writes
into the RTCC that contains only 32 registers (table 4-1 of
datasheet). I assumed
32 as the maximum length of data to write before wrapping up (start
from reg 0x0).
Probably 32 is just a wrong assumption but why did you choose 255?

Another thing: don't we need also to check count against the array length?

if (count > MCP795_MAX_DATAOUT_LEN)
return -EINVAL;


Re: [PATCH] rtc: mcp795: remove VLA usage

2018-03-13 Thread Stefano Manni
Hi,

2018-03-13 0:31 GMT+01:00 Alexandre Belloni
:
> Hi,
>
> On 13/03/2018 at 00:13:38 +0100, Stefano Manni wrote:
>> In preparation to enabling -Wvla, remove VLAs and replace them with
>> fixed-length arrays instead.
>>
>> rtc-mcp795.c uses a variable-length array declaration to contain
>> the command to write the rtcc; this can be replaced by a fixed-
>> size array of length 2 (instruction, address) + 32 (data out),
>> assuming a maximum data length of 32 bytes before wrap up.
>>
>> This was prompted by https://lkml.org/lkml/2018/3/7/621
>>
>> Signed-off-by: Stefano Manni 
>> ---
>>  drivers/rtc/rtc-mcp795.c | 8 +++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c
>> index 77f21331ae21..a5f504e2364c 100644
>> --- a/drivers/rtc/rtc-mcp795.c
>> +++ b/drivers/rtc/rtc-mcp795.c
>> @@ -61,6 +61,9 @@
>>
>>  #define SEC_PER_DAY  (24 * 60 * 60)
>>
>> +/* Maximum length for data out in write operation to RTCC */
>> +#define MCP795_MAX_DATAOUT_LEN   32
>> +
>
> This is wrong, see https://marc.info/?l=linux-kernel=152046370320811=2
>
> Also, 
> https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next=74ce1a932504da166cfbccf5567aa3751b6aa599
>

You sure that the right value to use is 255 + 2? mcp795_rtcc_write() just writes
into the RTCC that contains only 32 registers (table 4-1 of
datasheet). I assumed
32 as the maximum length of data to write before wrapping up (start
from reg 0x0).
Probably 32 is just a wrong assumption but why did you choose 255?

Another thing: don't we need also to check count against the array length?

if (count > MCP795_MAX_DATAOUT_LEN)
return -EINVAL;


[PATCH] rtc: mcp795: remove VLA usage

2018-03-12 Thread Stefano Manni
In preparation to enabling -Wvla, remove VLAs and replace them with
fixed-length arrays instead.

rtc-mcp795.c uses a variable-length array declaration to contain
the command to write the rtcc; this can be replaced by a fixed-
size array of length 2 (instruction, address) + 32 (data out),
assuming a maximum data length of 32 bytes before wrap up.

This was prompted by https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/rtc/rtc-mcp795.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c
index 77f21331ae21..a5f504e2364c 100644
--- a/drivers/rtc/rtc-mcp795.c
+++ b/drivers/rtc/rtc-mcp795.c
@@ -61,6 +61,9 @@
 
 #define SEC_PER_DAY(24 * 60 * 60)
 
+/* Maximum length for data out in write operation to RTCC */
+#define MCP795_MAX_DATAOUT_LEN 32
+
 static int mcp795_rtcc_read(struct device *dev, u8 addr, u8 *buf, u8 count)
 {
struct spi_device *spi = to_spi_device(dev);
@@ -82,7 +85,10 @@ static int mcp795_rtcc_write(struct device *dev, u8 addr, u8 
*data, u8 count)
 {
struct spi_device *spi = to_spi_device(dev);
int ret;
-   u8 tx[2 + count];
+   u8 tx[2 + MCP795_MAX_DATAOUT_LEN];
+
+   if (count > MCP795_MAX_DATAOUT_LEN)
+   return -EINVAL;
 
tx[0] = MCP795_WRITE;
tx[1] = addr;
-- 
2.14.3



[PATCH] rtc: mcp795: remove VLA usage

2018-03-12 Thread Stefano Manni
In preparation to enabling -Wvla, remove VLAs and replace them with
fixed-length arrays instead.

rtc-mcp795.c uses a variable-length array declaration to contain
the command to write the rtcc; this can be replaced by a fixed-
size array of length 2 (instruction, address) + 32 (data out),
assuming a maximum data length of 32 bytes before wrap up.

This was prompted by https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Stefano Manni 
---
 drivers/rtc/rtc-mcp795.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c
index 77f21331ae21..a5f504e2364c 100644
--- a/drivers/rtc/rtc-mcp795.c
+++ b/drivers/rtc/rtc-mcp795.c
@@ -61,6 +61,9 @@
 
 #define SEC_PER_DAY(24 * 60 * 60)
 
+/* Maximum length for data out in write operation to RTCC */
+#define MCP795_MAX_DATAOUT_LEN 32
+
 static int mcp795_rtcc_read(struct device *dev, u8 addr, u8 *buf, u8 count)
 {
struct spi_device *spi = to_spi_device(dev);
@@ -82,7 +85,10 @@ static int mcp795_rtcc_write(struct device *dev, u8 addr, u8 
*data, u8 count)
 {
struct spi_device *spi = to_spi_device(dev);
int ret;
-   u8 tx[2 + count];
+   u8 tx[2 + MCP795_MAX_DATAOUT_LEN];
+
+   if (count > MCP795_MAX_DATAOUT_LEN)
+   return -EINVAL;
 
tx[0] = MCP795_WRITE;
tx[1] = addr;
-- 
2.14.3



[PATCH v2 2/2] staging: rtl8712: fix signedness of length to rtl8717_set_ie

2018-02-18 Thread Stefano Manni
rtl8717_set_it() takes an unsigned int pointer as length,
fixed signedness in code using it.

Sparse warnings:

drivers/staging/rtl8712/ieee80211.c:191:53: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:191:53:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:191:53:got int *
drivers/staging/rtl8712/ieee80211.c:197:57: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:197:57:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:197:57:got int *
drivers/staging/rtl8712/ieee80211.c:199:63: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:199:63:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:199:63:got int *
drivers/staging/rtl8712/ieee80211.c:202:67: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:202:67:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:202:67:got int *
drivers/staging/rtl8712/ieee80211.c:206:73: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:206:73:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:206:73:got int *
drivers/staging/rtl8712/ieee80211.c:209:75: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:209:75:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:209:75:got int *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/rtl8712/ieee80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 612ccfe..7a4c00e 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -166,7 +166,8 @@ static uint r8712_get_rateset_len(u8 *rateset)
 
 int r8712_generate_ie(struct registry_priv *pregistrypriv)
 {
-   int sz = 0, rate_len;
+   int rate_len;
+   uint sz = 0;
struct wlan_bssid_ex *pdev_network = >dev_network;
u8 *ie = pdev_network->IEs;
u16 beaconPeriod = (u16)pdev_network->Configuration.BeaconPeriod;
-- 
2.9.4



[PATCH v2 2/2] staging: rtl8712: fix signedness of length to rtl8717_set_ie

2018-02-18 Thread Stefano Manni
rtl8717_set_it() takes an unsigned int pointer as length,
fixed signedness in code using it.

Sparse warnings:

drivers/staging/rtl8712/ieee80211.c:191:53: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:191:53:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:191:53:got int *
drivers/staging/rtl8712/ieee80211.c:197:57: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:197:57:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:197:57:got int *
drivers/staging/rtl8712/ieee80211.c:199:63: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:199:63:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:199:63:got int *
drivers/staging/rtl8712/ieee80211.c:202:67: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:202:67:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:202:67:got int *
drivers/staging/rtl8712/ieee80211.c:206:73: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:206:73:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:206:73:got int *
drivers/staging/rtl8712/ieee80211.c:209:75: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:209:75:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:209:75:got int *

Signed-off-by: Stefano Manni 
---
 drivers/staging/rtl8712/ieee80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 612ccfe..7a4c00e 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -166,7 +166,8 @@ static uint r8712_get_rateset_len(u8 *rateset)
 
 int r8712_generate_ie(struct registry_priv *pregistrypriv)
 {
-   int sz = 0, rate_len;
+   int rate_len;
+   uint sz = 0;
struct wlan_bssid_ex *pdev_network = >dev_network;
u8 *ie = pdev_network->IEs;
u16 beaconPeriod = (u16)pdev_network->Configuration.BeaconPeriod;
-- 
2.9.4



[PATCH v2 1/2] staging: rtl8712: make unsigned length for rtl8717_get{_wpa_,_wpa2_,_}ie

2018-02-18 Thread Stefano Manni
Fixed r8712_get_ie, r8712_get_wpa_ie, r8712_get_wpa2_ie
to have a length as unsigned int pointer instead of signed.

Sparse warnings:

drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: warning: incorrect type 
in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33:expected int 
*rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: warning: incorrect type 
in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33:expected int 
*rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: warning: incorrect type in 
argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59:expected signed int *len
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59:got unsigned int *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/rtl8712/ieee80211.c| 8 
 drivers/staging/rtl8712/ieee80211.h| 6 +++---
 drivers/staging/rtl8712/rtl871x_mlme.c | 3 ++-
 drivers/staging/rtl8712/rtl871x_xmit.c | 2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 9872703..612ccfe 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -107,7 +107,7 @@ u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 
*source, uint *frlen)
  * index: the information element id index, limit is the limit for search
  * ---
  */
-u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit)
+u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit)
 {
sint tmp, i;
u8 *p;
@@ -211,9 +211,9 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
return sz;
 }
 
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
+unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *wpa_ie_len, int 
limit)
 {
-   int len;
+   u32 len;
u16 val16;
unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
u8 *pbuf = pie;
@@ -245,7 +245,7 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int 
*wpa_ie_len, int limit)
return NULL;
 }
 
-unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int 
limit)
+unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, int 
limit)
 {
return r8712_get_ie(pie, _WPA2_IE_ID_, rsn_ie_len, limit);
 }
diff --git a/drivers/staging/rtl8712/ieee80211.h 
b/drivers/staging/rtl8712/ieee80211.h
index 68fd65e..d605dfd 100644
--- a/drivers/staging/rtl8712/ieee80211.h
+++ b/drivers/staging/rtl8712/ieee80211.h
@@ -738,9 +738,9 @@ static inline int ieee80211_get_hdrlen(u16 fc)
 struct registry_priv;
 
 u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
-u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit);
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *rsn_ie_len, int 
limit);
-unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len,
+u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit);
+unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *rsn_ie_len, int 
limit);
+unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len,
 int limit);
 int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
   int *pairwise_cipher);
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index 7824508..ac547dd 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -1725,7 +1725,8 @@ unsigned int r8712_restructure_ht_ie(struct _adapter 
*padapter, u8 *in_ie,
 static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 {
u8 *p, max_ampdu_sz;
-   int i, len;
+   int i;
+   uint len;
struct sta_info *bmc_sta, *psta;

[PATCH v2 1/2] staging: rtl8712: make unsigned length for rtl8717_get{_wpa_,_wpa2_,_}ie

2018-02-18 Thread Stefano Manni
Fixed r8712_get_ie, r8712_get_wpa_ie, r8712_get_wpa2_ie
to have a length as unsigned int pointer instead of signed.

Sparse warnings:

drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: warning: incorrect type 
in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33:expected int 
*rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: warning: incorrect type 
in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33:expected int 
*rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: warning: incorrect type in 
argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59:expected signed int *len
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59:got unsigned int *

Signed-off-by: Stefano Manni 
---
 drivers/staging/rtl8712/ieee80211.c| 8 
 drivers/staging/rtl8712/ieee80211.h| 6 +++---
 drivers/staging/rtl8712/rtl871x_mlme.c | 3 ++-
 drivers/staging/rtl8712/rtl871x_xmit.c | 2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 9872703..612ccfe 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -107,7 +107,7 @@ u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 
*source, uint *frlen)
  * index: the information element id index, limit is the limit for search
  * ---
  */
-u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit)
+u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit)
 {
sint tmp, i;
u8 *p;
@@ -211,9 +211,9 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
return sz;
 }
 
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
+unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *wpa_ie_len, int 
limit)
 {
-   int len;
+   u32 len;
u16 val16;
unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
u8 *pbuf = pie;
@@ -245,7 +245,7 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int 
*wpa_ie_len, int limit)
return NULL;
 }
 
-unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int 
limit)
+unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, int 
limit)
 {
return r8712_get_ie(pie, _WPA2_IE_ID_, rsn_ie_len, limit);
 }
diff --git a/drivers/staging/rtl8712/ieee80211.h 
b/drivers/staging/rtl8712/ieee80211.h
index 68fd65e..d605dfd 100644
--- a/drivers/staging/rtl8712/ieee80211.h
+++ b/drivers/staging/rtl8712/ieee80211.h
@@ -738,9 +738,9 @@ static inline int ieee80211_get_hdrlen(u16 fc)
 struct registry_priv;
 
 u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
-u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit);
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *rsn_ie_len, int 
limit);
-unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len,
+u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit);
+unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *rsn_ie_len, int 
limit);
+unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len,
 int limit);
 int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
   int *pairwise_cipher);
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index 7824508..ac547dd 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -1725,7 +1725,8 @@ unsigned int r8712_restructure_ht_ie(struct _adapter 
*padapter, u8 *in_ie,
 static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 {
u8 *p, max_ampdu_sz;
-   int i, len;
+   int i;
+   uint len;
struct sta_info *bmc_sta, *psta;
struct ieee80211_ht_cap *pht_capie

Re: [PATCH 1/2] staging: rtl8712: make unsigned length for rtl8717_get{_wpa_,_wpa2_,_}ie

2018-02-18 Thread Stefano Manni
On Fri, 2018-02-16 at 15:48 +0100, Greg KH wrote:
> Can you rebase both of these patches on the staging-testing branch of
> the staging.git tree so that I can apply them?  Right now they have
> too
> many conflicts.

Rebased on staging-testing d92a1fa. v2 to come.




Re: [PATCH 1/2] staging: rtl8712: make unsigned length for rtl8717_get{_wpa_,_wpa2_,_}ie

2018-02-18 Thread Stefano Manni
On Fri, 2018-02-16 at 15:48 +0100, Greg KH wrote:
> Can you rebase both of these patches on the staging-testing branch of
> the staging.git tree so that I can apply them?  Right now they have
> too
> many conflicts.

Rebased on staging-testing d92a1fa. v2 to come.




[PATCH 1/2] staging: rtl8712: make unsigned length for rtl8717_get{_wpa_,_wpa2_,_}ie

2018-02-01 Thread Stefano Manni
Fixed r8712_get_ie, r8712_get_wpa_ie, r8712_get_wpa2_ie
to have a length as unsigned int pointer instead of signed.

Sparse warnings:

drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: warning: incorrect type 
in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33:expected int 
*rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: warning: incorrect type 
in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33:expected int 
*rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: warning: incorrect type in 
argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59:expected signed int *len
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59:got unsigned int *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/rtl8712/ieee80211.c| 8 
 drivers/staging/rtl8712/ieee80211.h| 6 +++---
 drivers/staging/rtl8712/rtl871x_mlme.c | 3 ++-
 drivers/staging/rtl8712/rtl871x_xmit.c | 2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 33e82a9dd462..35e29112006b 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -107,7 +107,7 @@ u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 
*source, uint *frlen)
  * index: the information element id index, limit is the limit for search
  * ---
  */
-u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit)
+u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit)
 {
sint tmp, i;
u8 *p;
@@ -210,9 +210,9 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
return sz;
 }
 
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
+unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *wpa_ie_len, int 
limit)
 {
-   int len;
+   u32 len;
u16 val16;
unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
u8 *pbuf = pie;
@@ -243,7 +243,7 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int 
*wpa_ie_len, int limit)
return NULL;
 }
 
-unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int 
limit)
+unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, int 
limit)
 {
return r8712_get_ie(pie, _WPA2_IE_ID_, rsn_ie_len, limit);
 }
diff --git a/drivers/staging/rtl8712/ieee80211.h 
b/drivers/staging/rtl8712/ieee80211.h
index 68fd65e80906..d605dfd02200 100644
--- a/drivers/staging/rtl8712/ieee80211.h
+++ b/drivers/staging/rtl8712/ieee80211.h
@@ -738,9 +738,9 @@ static inline int ieee80211_get_hdrlen(u16 fc)
 struct registry_priv;
 
 u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
-u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit);
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *rsn_ie_len, int 
limit);
-unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len,
+u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit);
+unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *rsn_ie_len, int 
limit);
+unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len,
 int limit);
 int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
   int *pairwise_cipher);
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index 111c809afc51..215fa8999a80 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -1728,7 +1728,8 @@ unsigned int r8712_restructure_ht_ie(struct _adapter 
*padapter, u8 *in_ie,
 static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 {
u8 *p, max_ampdu_sz;
-   int i, len;
+   int i;
+   uint len;
struct sta_info *b

[PATCH 2/2] staging: rtl8712: fix signedness of length to rtl8717_set_ie

2018-02-01 Thread Stefano Manni
rtl8717_set_it() takes an unsigned int pointer as length,
fixed signedness in code using it.

Sparse warnings:

drivers/staging/rtl8712/ieee80211.c:191:53: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:191:53:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:191:53:got int *
drivers/staging/rtl8712/ieee80211.c:197:57: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:197:57:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:197:57:got int *
drivers/staging/rtl8712/ieee80211.c:199:63: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:199:63:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:199:63:got int *
drivers/staging/rtl8712/ieee80211.c:202:67: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:202:67:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:202:67:got int *
drivers/staging/rtl8712/ieee80211.c:206:73: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:206:73:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:206:73:got int *
drivers/staging/rtl8712/ieee80211.c:209:75: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:209:75:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:209:75:got int *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/rtl8712/ieee80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 35e29112006b..5095af13a6dc 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -166,7 +166,8 @@ static uint r8712_get_rateset_len(u8 *rateset)
 
 int r8712_generate_ie(struct registry_priv *pregistrypriv)
 {
-   int sz = 0, rate_len;
+   int rate_len;
+   uint sz = 0;
struct wlan_bssid_ex *pdev_network = >dev_network;
u8 *ie = pdev_network->IEs;
 
-- 
2.14.3



[PATCH 1/2] staging: rtl8712: make unsigned length for rtl8717_get{_wpa_,_wpa2_,_}ie

2018-02-01 Thread Stefano Manni
Fixed r8712_get_ie, r8712_get_wpa_ie, r8712_get_wpa2_ie
to have a length as unsigned int pointer instead of signed.

Sparse warnings:

drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: warning: incorrect type 
in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67:expected signed int 
*len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: warning: incorrect type 
in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33:expected int 
*rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: warning: incorrect type 
in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33:expected int 
*rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33:got unsigned int 
*
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: warning: incorrect type in 
argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59:expected signed int *len
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59:got unsigned int *

Signed-off-by: Stefano Manni 
---
 drivers/staging/rtl8712/ieee80211.c| 8 
 drivers/staging/rtl8712/ieee80211.h| 6 +++---
 drivers/staging/rtl8712/rtl871x_mlme.c | 3 ++-
 drivers/staging/rtl8712/rtl871x_xmit.c | 2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 33e82a9dd462..35e29112006b 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -107,7 +107,7 @@ u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 
*source, uint *frlen)
  * index: the information element id index, limit is the limit for search
  * ---
  */
-u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit)
+u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit)
 {
sint tmp, i;
u8 *p;
@@ -210,9 +210,9 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
return sz;
 }
 
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
+unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *wpa_ie_len, int 
limit)
 {
-   int len;
+   u32 len;
u16 val16;
unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
u8 *pbuf = pie;
@@ -243,7 +243,7 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int 
*wpa_ie_len, int limit)
return NULL;
 }
 
-unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int 
limit)
+unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, int 
limit)
 {
return r8712_get_ie(pie, _WPA2_IE_ID_, rsn_ie_len, limit);
 }
diff --git a/drivers/staging/rtl8712/ieee80211.h 
b/drivers/staging/rtl8712/ieee80211.h
index 68fd65e80906..d605dfd02200 100644
--- a/drivers/staging/rtl8712/ieee80211.h
+++ b/drivers/staging/rtl8712/ieee80211.h
@@ -738,9 +738,9 @@ static inline int ieee80211_get_hdrlen(u16 fc)
 struct registry_priv;
 
 u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
-u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit);
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *rsn_ie_len, int 
limit);
-unsigned char *r8712_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len,
+u8 *r8712_get_ie(u8 *pbuf, sint index, uint *len, sint limit);
+unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *rsn_ie_len, int 
limit);
+unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len,
 int limit);
 int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
   int *pairwise_cipher);
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index 111c809afc51..215fa8999a80 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -1728,7 +1728,8 @@ unsigned int r8712_restructure_ht_ie(struct _adapter 
*padapter, u8 *in_ie,
 static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 {
u8 *p, max_ampdu_sz;
-   int i, len;
+   int i;
+   uint len;
struct sta_info *bmc_sta, *psta;
struct

[PATCH 2/2] staging: rtl8712: fix signedness of length to rtl8717_set_ie

2018-02-01 Thread Stefano Manni
rtl8717_set_it() takes an unsigned int pointer as length,
fixed signedness in code using it.

Sparse warnings:

drivers/staging/rtl8712/ieee80211.c:191:53: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:191:53:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:191:53:got int *
drivers/staging/rtl8712/ieee80211.c:197:57: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:197:57:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:197:57:got int *
drivers/staging/rtl8712/ieee80211.c:199:63: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:199:63:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:199:63:got int *
drivers/staging/rtl8712/ieee80211.c:202:67: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:202:67:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:202:67:got int *
drivers/staging/rtl8712/ieee80211.c:206:73: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:206:73:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:206:73:got int *
drivers/staging/rtl8712/ieee80211.c:209:75: warning: incorrect type in argument 
5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:209:75:expected unsigned int [usertype] 
*frlen
drivers/staging/rtl8712/ieee80211.c:209:75:got int *

Signed-off-by: Stefano Manni 
---
 drivers/staging/rtl8712/ieee80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 35e29112006b..5095af13a6dc 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -166,7 +166,8 @@ static uint r8712_get_rateset_len(u8 *rateset)
 
 int r8712_generate_ie(struct registry_priv *pregistrypriv)
 {
-   int sz = 0, rate_len;
+   int rate_len;
+   uint sz = 0;
struct wlan_bssid_ex *pdev_network = >dev_network;
u8 *ie = pdev_network->IEs;
 
-- 
2.14.3



Re: [PATCH 1/4] staging: lustre: fixed signedness of some socklnd params

2017-11-23 Thread Stefano Manni
On Thu, 2017-11-23 at 15:13 +0300, Dan Carpenter wrote:
> I've looked through this series and I feel like none of these are
> real
> bugs.  It's just about type safety and being consistent.  Which are
> good
> things.  I'm not sure that I like the parts where we make the
> variables
> signed.
> 
> Here "nscheds" is the number of threads.  How can we have a negative
> number?  I think it should be unsigned.  It's way more tricky to
> change
> the rest of the code, and leave nscheds unsigned int but I think it's
> probably the right thing.
> 
> regards,
> dan carpenter
> 

I've made the module param nsched signed because the
ksock_tunables.ksnd_nscheds (the real container) is signed too.

I definitely agree with you that it does not make sense to have a
negative number of threads.
In my opinion it's better to fix this inconsistency between the param
and the container and then try submit another patch to harmonize
signedness around the code.

Thanks,
Stefano



Re: [PATCH 1/4] staging: lustre: fixed signedness of some socklnd params

2017-11-23 Thread Stefano Manni
On Thu, 2017-11-23 at 15:13 +0300, Dan Carpenter wrote:
> I've looked through this series and I feel like none of these are
> real
> bugs.  It's just about type safety and being consistent.  Which are
> good
> things.  I'm not sure that I like the parts where we make the
> variables
> signed.
> 
> Here "nscheds" is the number of threads.  How can we have a negative
> number?  I think it should be unsigned.  It's way more tricky to
> change
> the rest of the code, and leave nscheds unsigned int but I think it's
> probably the right thing.
> 
> regards,
> dan carpenter
> 

I've made the module param nsched signed because the
ksock_tunables.ksnd_nscheds (the real container) is signed too.

I definitely agree with you that it does not make sense to have a
negative number of threads.
In my opinion it's better to fix this inconsistency between the param
and the container and then try submit another patch to harmonize
signedness around the code.

Thanks,
Stefano



Re: [PATCH 0/4] staging: lustre: fixed some signedness warns from sparse

2017-11-23 Thread Stefano Manni
On Fri, 2017-11-24 at 09:20 +1100, Tobin C. Harding wrote:
> On Thu, Nov 23, 2017 at 02:51:38PM +0300, Dan Carpenter wrote:
> > On Thu, Nov 23, 2017 at 03:59:26PM +1100, Tobin C. Harding wrote:
> > > On Wed, Nov 22, 2017 at 08:38:27PM +0100, Stefano Manni wrote:
> > > > Fixed some signedness warnings from sparse on lustre.
> > > > 
> > > > Stefano Manni (4):
> > > >   staging: lustre: fixed signedness of some socklnd params
> > > >   staging: lustre: fixed signedness of llite
> > > >   staging: lustre: fixed signedness of lov
> > > >   staging: lustre: fixed signedness of obdclass
> > > 
> > > You may like to use imperative mood for your git log brief
> > > descriptions
> > > Stefano.  
> > > 
> > > s/fixed/fix/
> > > 
> > 
> > Someone once chewed me a second butt hole for not using the
> > imperative
> > mood so I know some people care intensely about this but I think so
> > long
> > as you can understand the description it's fine.  I will never send
> > a
> > patch for that maintainer's subsystem again, btw, which is probably
> > grateful for and now I can poop twice as fast so we're both
> > winners.
> 
> I try to only make these suggestions to people doing clean up patches
> to
> staging, with the reasoning that if we are learning we might as well
> learn the correct method from the start.

It's ok with your suggestion. Not a hard work to rebase 4 commit and
change the commit message.

Thanks,
Stefano


Re: [PATCH 0/4] staging: lustre: fixed some signedness warns from sparse

2017-11-23 Thread Stefano Manni
On Fri, 2017-11-24 at 09:20 +1100, Tobin C. Harding wrote:
> On Thu, Nov 23, 2017 at 02:51:38PM +0300, Dan Carpenter wrote:
> > On Thu, Nov 23, 2017 at 03:59:26PM +1100, Tobin C. Harding wrote:
> > > On Wed, Nov 22, 2017 at 08:38:27PM +0100, Stefano Manni wrote:
> > > > Fixed some signedness warnings from sparse on lustre.
> > > > 
> > > > Stefano Manni (4):
> > > >   staging: lustre: fixed signedness of some socklnd params
> > > >   staging: lustre: fixed signedness of llite
> > > >   staging: lustre: fixed signedness of lov
> > > >   staging: lustre: fixed signedness of obdclass
> > > 
> > > You may like to use imperative mood for your git log brief
> > > descriptions
> > > Stefano.  
> > > 
> > > s/fixed/fix/
> > > 
> > 
> > Someone once chewed me a second butt hole for not using the
> > imperative
> > mood so I know some people care intensely about this but I think so
> > long
> > as you can understand the description it's fine.  I will never send
> > a
> > patch for that maintainer's subsystem again, btw, which is probably
> > grateful for and now I can poop twice as fast so we're both
> > winners.
> 
> I try to only make these suggestions to people doing clean up patches
> to
> staging, with the reasoning that if we are learning we might as well
> learn the correct method from the start.

It's ok with your suggestion. Not a hard work to rebase 4 commit and
change the commit message.

Thanks,
Stefano


[PATCH 3/4] staging: lustre: fixed signedness of lov

2017-11-22 Thread Stefano Manni
sparse warning on lov_obd.c:
warning: incorrect type in argument 3 (different signedness)
expected int *res
got unsigned int [usertype] *i

sparse warning on lov_offset.c:
warning: incorrect type in argument 4 (different signedness)
expected long long [usertype] *
got unsigned long long *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/lustre/lustre/lov/lov_obd.c|  2 +-
 drivers/staging/lustre/lustre/lov/lov_offset.c | 11 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c 
b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 7ce0102..3cccd79 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -899,7 +899,7 @@ int lov_process_config_base(struct obd_device *obd, struct 
lustre_cfg *lcfg,
 
obd_str2uuid(_uuid,  lustre_cfg_buf(lcfg, 1));
 
-   rc = kstrtoint(lustre_cfg_buf(lcfg, 2), 10, indexp);
+   rc = kstrtouint(lustre_cfg_buf(lcfg, 2), 10, indexp);
if (rc < 0)
goto out;
rc = kstrtoint(lustre_cfg_buf(lcfg, 3), 10, genp);
diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c 
b/drivers/staging/lustre/lustre/lov/lov_offset.c
index 3e16e64..954a01b 100644
--- a/drivers/staging/lustre/lustre/lov/lov_offset.c
+++ b/drivers/staging/lustre/lustre/lov/lov_offset.c
@@ -44,7 +44,7 @@ u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size, 
int stripeno)
 {
unsigned long ssize = lsm->lsm_stripe_size;
unsigned long stripe_size;
-   u64 swidth;
+   long long swidth;
u64 lov_size;
int magic = lsm->lsm_magic;
 
@@ -128,7 +128,8 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, u64 
lov_off,
  int stripeno, u64 *obdoff)
 {
unsigned long ssize  = lsm->lsm_stripe_size;
-   u64 stripe_off, this_stripe, swidth;
+   long long swidth;
+   u64 stripe_off, this_stripe;
int magic = lsm->lsm_magic;
int ret = 0;
 
@@ -183,7 +184,8 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 
file_size,
   int stripeno)
 {
unsigned long ssize  = lsm->lsm_stripe_size;
-   u64 stripe_off, this_stripe, swidth;
+   long long swidth;
+   u64 stripe_off, this_stripe;
int magic = lsm->lsm_magic;
 
if (file_size == OBD_OBJECT_EOF)
@@ -257,7 +259,8 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int 
stripeno,
 int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off)
 {
unsigned long ssize  = lsm->lsm_stripe_size;
-   u64 stripe_off, swidth;
+   long long swidth;
+   u64 stripe_off;
int magic = lsm->lsm_magic;
 
lsm_op_find(magic)->lsm_stripe_by_offset(lsm, NULL, _off, );
-- 
2.5.5



[PATCH 3/4] staging: lustre: fixed signedness of lov

2017-11-22 Thread Stefano Manni
sparse warning on lov_obd.c:
warning: incorrect type in argument 3 (different signedness)
expected int *res
got unsigned int [usertype] *i

sparse warning on lov_offset.c:
warning: incorrect type in argument 4 (different signedness)
expected long long [usertype] *
got unsigned long long *

Signed-off-by: Stefano Manni 
---
 drivers/staging/lustre/lustre/lov/lov_obd.c|  2 +-
 drivers/staging/lustre/lustre/lov/lov_offset.c | 11 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c 
b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 7ce0102..3cccd79 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -899,7 +899,7 @@ int lov_process_config_base(struct obd_device *obd, struct 
lustre_cfg *lcfg,
 
obd_str2uuid(_uuid,  lustre_cfg_buf(lcfg, 1));
 
-   rc = kstrtoint(lustre_cfg_buf(lcfg, 2), 10, indexp);
+   rc = kstrtouint(lustre_cfg_buf(lcfg, 2), 10, indexp);
if (rc < 0)
goto out;
rc = kstrtoint(lustre_cfg_buf(lcfg, 3), 10, genp);
diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c 
b/drivers/staging/lustre/lustre/lov/lov_offset.c
index 3e16e64..954a01b 100644
--- a/drivers/staging/lustre/lustre/lov/lov_offset.c
+++ b/drivers/staging/lustre/lustre/lov/lov_offset.c
@@ -44,7 +44,7 @@ u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size, 
int stripeno)
 {
unsigned long ssize = lsm->lsm_stripe_size;
unsigned long stripe_size;
-   u64 swidth;
+   long long swidth;
u64 lov_size;
int magic = lsm->lsm_magic;
 
@@ -128,7 +128,8 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, u64 
lov_off,
  int stripeno, u64 *obdoff)
 {
unsigned long ssize  = lsm->lsm_stripe_size;
-   u64 stripe_off, this_stripe, swidth;
+   long long swidth;
+   u64 stripe_off, this_stripe;
int magic = lsm->lsm_magic;
int ret = 0;
 
@@ -183,7 +184,8 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 
file_size,
   int stripeno)
 {
unsigned long ssize  = lsm->lsm_stripe_size;
-   u64 stripe_off, this_stripe, swidth;
+   long long swidth;
+   u64 stripe_off, this_stripe;
int magic = lsm->lsm_magic;
 
if (file_size == OBD_OBJECT_EOF)
@@ -257,7 +259,8 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int 
stripeno,
 int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off)
 {
unsigned long ssize  = lsm->lsm_stripe_size;
-   u64 stripe_off, swidth;
+   long long swidth;
+   u64 stripe_off;
int magic = lsm->lsm_magic;
 
lsm_op_find(magic)->lsm_stripe_by_offset(lsm, NULL, _off, );
-- 
2.5.5



[PATCH 4/4] staging: lustre: fixed signedness of obdclass

2017-11-22 Thread Stefano Manni
sparse warning on obd_mount.c:
warning: incorrect type in argument 5 (different signedness)
expected unsigned int [usertype] *vallen
got int *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c 
b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 2a79a22..b0af897 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -273,7 +273,7 @@ int lustre_start_mgc(struct super_block *sb)
/* IR compatibility check, only for clients */
if (lmd_is_client(lsi->lsi_lmd)) {
int has_ir;
-   int vallen = sizeof(*data);
+   unsigned int vallen = sizeof(*data);
__u32 *flags = >lsi_lmd->lmd_flags;
 
rc = obd_get_info(NULL, obd->obd_self_export,
-- 
2.5.5



[PATCH 4/4] staging: lustre: fixed signedness of obdclass

2017-11-22 Thread Stefano Manni
sparse warning on obd_mount.c:
warning: incorrect type in argument 5 (different signedness)
expected unsigned int [usertype] *vallen
got int *

Signed-off-by: Stefano Manni 
---
 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c 
b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 2a79a22..b0af897 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -273,7 +273,7 @@ int lustre_start_mgc(struct super_block *sb)
/* IR compatibility check, only for clients */
if (lmd_is_client(lsi->lsi_lmd)) {
int has_ir;
-   int vallen = sizeof(*data);
+   unsigned int vallen = sizeof(*data);
__u32 *flags = >lsi_lmd->lmd_flags;
 
rc = obd_get_info(NULL, obd->obd_self_export,
-- 
2.5.5



[PATCH 1/4] staging: lustre: fixed signedness of some socklnd params

2017-11-22 Thread Stefano Manni
sparse warnings:
warning: incorrect type in assignment (different signedness)
expected int *[addressable] [toplevel] [assigned] ksnd_nscheds
got unsigned int static [toplevel] *
warning: incorrect type in assignment (different signedness)
expected int *[addressable] [toplevel] [assigned] ksnd_zc_recv
got unsigned int static [toplevel] *
warning: incorrect type in assignment (different signedness)
expected int *[addressable] [toplevel] [assigned] ksnd_zc_recv_min_nfrags
got unsigned int static [toplevel] *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h   | 4 ++--
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index d50ebdf..474f93a 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -158,10 +158,10 @@ struct ksock_tunables {
unsigned int *ksnd_zc_min_payload; /* minimum zero copy payload
* size
*/
-   int  *ksnd_zc_recv;/* enable ZC receive (for
+   unsigned int *ksnd_zc_recv;/* enable ZC receive (for
* Chelsio TOE)
*/
-   int  *ksnd_zc_recv_min_nfrags; /* minimum # of fragments to
+   unsigned int *ksnd_zc_recv_min_nfrags; /* minimum # of fragments to
* enable ZC receive
*/
 };
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
index 5663a4c..2ad89ca 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
@@ -43,7 +43,7 @@ MODULE_PARM_DESC(peer_timeout, "Seconds without aliveness 
news to declare peer d
  * Number of daemons in each thread pool which is percpt,
  * we will estimate reasonable value based on CPUs if it's not set.
  */
-static unsigned int nscheds;
+static int nscheds;
 module_param(nscheds, int, 0444);
 MODULE_PARM_DESC(nscheds, "# scheduler daemons in each pool while starting");
 
-- 
2.5.5



[PATCH 2/4] staging: lustre: fixed signedness of llite

2017-11-22 Thread Stefano Manni
sparse warnings on dir.c:
warning: incorrect type in argument 5 (different signedness)
expected unsigned int [usertype] *vallen
got int *

sparse warnings on llite_lib.c:
warning: incorrect type in argument 5 (different signedness)
expected unsigned int [usertype] *vallen
got int *

sparse warnings on lproc_llite.c:
warning: incorrect type in argument 2 (different signedness)
expected int *max_mdsize
got unsigned int *
warning: incorrect type in argument 2 (different signedness)
expected int *default_mdsize
got unsigned int *
warning: incorrect type in initializer (different signedness)
expected int *off_count
got unsigned int *
warning: incorrect type in initializer (different signedness)
expected int *process_count
got unsigned int *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/lustre/lustre/llite/dir.c |  3 ++-
 drivers/staging/lustre/lustre/llite/llite_lib.c   |  9 ++---
 drivers/staging/lustre/lustre/llite/lproc_llite.c | 14 ++
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 5b2e47c..ee6e8ef 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1422,7 +1422,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
case LL_IOC_FLUSHCTX:
return ll_flush_ctx(inode);
case LL_IOC_GETOBDCOUNT: {
-   int count, vallen;
+   int count;
+   unsigned int vallen;
struct obd_export *exp;
 
if (copy_from_user(, (int __user *)arg, sizeof(int)))
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 8666f1e..6f82bff 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -159,7 +159,8 @@ static int client_common_fill_super(struct super_block *sb, 
char *md, char *dt,
struct md_op_data *op_data;
struct lustre_md lmd;
u64 valid;
-   int size, err, checksum;
+   int err, checksum;
+   unsigned int size;
 
obd = class_name2obd(md);
if (!obd) {
@@ -571,7 +572,8 @@ static int client_common_fill_super(struct super_block *sb, 
char *md, char *dt,
 
 int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)
 {
-   int size, rc;
+   int rc;
+   unsigned int size;
 
size = sizeof(*lmmsize);
rc = obd_get_info(NULL, sbi->ll_dt_exp, sizeof(KEY_MAX_EASIZE),
@@ -604,7 +606,8 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)
  */
 int ll_get_default_mdsize(struct ll_sb_info *sbi, int *lmmsize)
 {
-   int size, rc;
+   int rc;
+   unsigned int size;
 
size = sizeof(int);
rc = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_DEFAULT_EASIZE),
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c 
b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 644bea2..52dbd56 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -734,14 +734,13 @@ static ssize_t max_easize_show(struct kobject *kobj,
 {
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
  ll_kobj);
-   unsigned int ealen;
-   int rc;
+   int rc, ealen;
 
rc = ll_get_max_mdsize(sbi, );
if (rc)
return rc;
 
-   return sprintf(buf, "%u\n", ealen);
+   return sprintf(buf, "%d\n", ealen);
 }
 LUSTRE_RO_ATTR(max_easize);
 
@@ -763,14 +762,13 @@ static ssize_t default_easize_show(struct kobject *kobj,
 {
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
  ll_kobj);
-   unsigned int ealen;
-   int rc;
+   int rc, ealen;
 
rc = ll_get_default_mdsize(sbi, );
if (rc)
return rc;
 
-   return sprintf(buf, "%u\n", ealen);
+   return sprintf(buf, "%d\n", ealen);
 }
 
 /**
@@ -1479,8 +1477,8 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
int i, cur = -1;
struct ll_rw_process_info *process;
struct ll_rw_process_info *offset;
-   int *off_count = >ll_rw_offset_entry_count;
-   int *process_count = >ll_offset_process_count;
+   unsigned int *off_count = >ll_rw_offset_entry_count;
+   unsigned int *process_count = >ll_offset_process_count;
struct ll_rw_extents_info *io_extents = >ll_rw_extents_info;
 
if (!sbi->ll_rw_stats_on)
-- 
2.5.5



[PATCH 1/4] staging: lustre: fixed signedness of some socklnd params

2017-11-22 Thread Stefano Manni
sparse warnings:
warning: incorrect type in assignment (different signedness)
expected int *[addressable] [toplevel] [assigned] ksnd_nscheds
got unsigned int static [toplevel] *
warning: incorrect type in assignment (different signedness)
expected int *[addressable] [toplevel] [assigned] ksnd_zc_recv
got unsigned int static [toplevel] *
warning: incorrect type in assignment (different signedness)
expected int *[addressable] [toplevel] [assigned] ksnd_zc_recv_min_nfrags
got unsigned int static [toplevel] *

Signed-off-by: Stefano Manni 
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h   | 4 ++--
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index d50ebdf..474f93a 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -158,10 +158,10 @@ struct ksock_tunables {
unsigned int *ksnd_zc_min_payload; /* minimum zero copy payload
* size
*/
-   int  *ksnd_zc_recv;/* enable ZC receive (for
+   unsigned int *ksnd_zc_recv;/* enable ZC receive (for
* Chelsio TOE)
*/
-   int  *ksnd_zc_recv_min_nfrags; /* minimum # of fragments to
+   unsigned int *ksnd_zc_recv_min_nfrags; /* minimum # of fragments to
* enable ZC receive
*/
 };
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
index 5663a4c..2ad89ca 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
@@ -43,7 +43,7 @@ MODULE_PARM_DESC(peer_timeout, "Seconds without aliveness 
news to declare peer d
  * Number of daemons in each thread pool which is percpt,
  * we will estimate reasonable value based on CPUs if it's not set.
  */
-static unsigned int nscheds;
+static int nscheds;
 module_param(nscheds, int, 0444);
 MODULE_PARM_DESC(nscheds, "# scheduler daemons in each pool while starting");
 
-- 
2.5.5



[PATCH 2/4] staging: lustre: fixed signedness of llite

2017-11-22 Thread Stefano Manni
sparse warnings on dir.c:
warning: incorrect type in argument 5 (different signedness)
expected unsigned int [usertype] *vallen
got int *

sparse warnings on llite_lib.c:
warning: incorrect type in argument 5 (different signedness)
expected unsigned int [usertype] *vallen
got int *

sparse warnings on lproc_llite.c:
warning: incorrect type in argument 2 (different signedness)
expected int *max_mdsize
got unsigned int *
warning: incorrect type in argument 2 (different signedness)
expected int *default_mdsize
got unsigned int *
warning: incorrect type in initializer (different signedness)
expected int *off_count
got unsigned int *
warning: incorrect type in initializer (different signedness)
expected int *process_count
got unsigned int *

Signed-off-by: Stefano Manni 
---
 drivers/staging/lustre/lustre/llite/dir.c |  3 ++-
 drivers/staging/lustre/lustre/llite/llite_lib.c   |  9 ++---
 drivers/staging/lustre/lustre/llite/lproc_llite.c | 14 ++
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 5b2e47c..ee6e8ef 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1422,7 +1422,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
case LL_IOC_FLUSHCTX:
return ll_flush_ctx(inode);
case LL_IOC_GETOBDCOUNT: {
-   int count, vallen;
+   int count;
+   unsigned int vallen;
struct obd_export *exp;
 
if (copy_from_user(, (int __user *)arg, sizeof(int)))
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 8666f1e..6f82bff 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -159,7 +159,8 @@ static int client_common_fill_super(struct super_block *sb, 
char *md, char *dt,
struct md_op_data *op_data;
struct lustre_md lmd;
u64 valid;
-   int size, err, checksum;
+   int err, checksum;
+   unsigned int size;
 
obd = class_name2obd(md);
if (!obd) {
@@ -571,7 +572,8 @@ static int client_common_fill_super(struct super_block *sb, 
char *md, char *dt,
 
 int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)
 {
-   int size, rc;
+   int rc;
+   unsigned int size;
 
size = sizeof(*lmmsize);
rc = obd_get_info(NULL, sbi->ll_dt_exp, sizeof(KEY_MAX_EASIZE),
@@ -604,7 +606,8 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)
  */
 int ll_get_default_mdsize(struct ll_sb_info *sbi, int *lmmsize)
 {
-   int size, rc;
+   int rc;
+   unsigned int size;
 
size = sizeof(int);
rc = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_DEFAULT_EASIZE),
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c 
b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 644bea2..52dbd56 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -734,14 +734,13 @@ static ssize_t max_easize_show(struct kobject *kobj,
 {
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
  ll_kobj);
-   unsigned int ealen;
-   int rc;
+   int rc, ealen;
 
rc = ll_get_max_mdsize(sbi, );
if (rc)
return rc;
 
-   return sprintf(buf, "%u\n", ealen);
+   return sprintf(buf, "%d\n", ealen);
 }
 LUSTRE_RO_ATTR(max_easize);
 
@@ -763,14 +762,13 @@ static ssize_t default_easize_show(struct kobject *kobj,
 {
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
  ll_kobj);
-   unsigned int ealen;
-   int rc;
+   int rc, ealen;
 
rc = ll_get_default_mdsize(sbi, );
if (rc)
return rc;
 
-   return sprintf(buf, "%u\n", ealen);
+   return sprintf(buf, "%d\n", ealen);
 }
 
 /**
@@ -1479,8 +1477,8 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
int i, cur = -1;
struct ll_rw_process_info *process;
struct ll_rw_process_info *offset;
-   int *off_count = >ll_rw_offset_entry_count;
-   int *process_count = >ll_offset_process_count;
+   unsigned int *off_count = >ll_rw_offset_entry_count;
+   unsigned int *process_count = >ll_offset_process_count;
struct ll_rw_extents_info *io_extents = >ll_rw_extents_info;
 
if (!sbi->ll_rw_stats_on)
-- 
2.5.5



[PATCH 0/4] staging: lustre: fixed some signedness warns from sparse

2017-11-22 Thread Stefano Manni
Fixed some signedness warnings from sparse on lustre.

Stefano Manni (4):
  staging: lustre: fixed signedness of some socklnd params
  staging: lustre: fixed signedness of llite
  staging: lustre: fixed signedness of lov
  staging: lustre: fixed signedness of obdclass

 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h|  4 ++--
 .../staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c  |  2 +-
 drivers/staging/lustre/lustre/llite/dir.c  |  3 ++-
 drivers/staging/lustre/lustre/llite/llite_lib.c|  9 ++---
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 14 ++
 drivers/staging/lustre/lustre/lov/lov_obd.c|  2 +-
 drivers/staging/lustre/lustre/lov/lov_offset.c | 11 +++
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |  2 +-
 8 files changed, 26 insertions(+), 21 deletions(-)

-- 
2.5.5



[PATCH 0/4] staging: lustre: fixed some signedness warns from sparse

2017-11-22 Thread Stefano Manni
Fixed some signedness warnings from sparse on lustre.

Stefano Manni (4):
  staging: lustre: fixed signedness of some socklnd params
  staging: lustre: fixed signedness of llite
  staging: lustre: fixed signedness of lov
  staging: lustre: fixed signedness of obdclass

 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h|  4 ++--
 .../staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c  |  2 +-
 drivers/staging/lustre/lustre/llite/dir.c  |  3 ++-
 drivers/staging/lustre/lustre/llite/llite_lib.c|  9 ++---
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 14 ++
 drivers/staging/lustre/lustre/lov/lov_obd.c|  2 +-
 drivers/staging/lustre/lustre/lov/lov_offset.c | 11 +++
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |  2 +-
 8 files changed, 26 insertions(+), 21 deletions(-)

-- 
2.5.5



[PATCH] staging: pi433: fixed signedness of 4th argument to kfifo_from_user

2017-11-16 Thread Stefano Manni
sparse warning:
incorrect type in initializer (different signedness)
expected unsigned int *__copied, got int *

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/pi433/pi433_if.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 2a205c6..6f9ab37 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -716,7 +716,8 @@ pi433_write(struct file *filp, const char __user *buf,
 {
struct pi433_instance   *instance;
struct pi433_device *device;
-   int copied, retval;
+   int retval;
+   unsigned intcopied;
 
instance = filp->private_data;
device = instance->device;
-- 
2.5.5



[PATCH] staging: pi433: fixed signedness of 4th argument to kfifo_from_user

2017-11-16 Thread Stefano Manni
sparse warning:
incorrect type in initializer (different signedness)
expected unsigned int *__copied, got int *

Signed-off-by: Stefano Manni 
---
 drivers/staging/pi433/pi433_if.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 2a205c6..6f9ab37 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -716,7 +716,8 @@ pi433_write(struct file *filp, const char __user *buf,
 {
struct pi433_instance   *instance;
struct pi433_device *device;
-   int copied, retval;
+   int retval;
+   unsigned intcopied;
 
instance = filp->private_data;
device = instance->device;
-- 
2.5.5



[PATCH] staging: fbtft: replace decimal with 4-digit octal permissions

2017-01-17 Thread Stefano Manni
Following error detected by checkpatch.pl:

ERROR: Use 4 digit octal (0777) not decimal permissions

Signed-off-by: Stefano Manni <stefano.ma...@gmail.com>
---
 drivers/staging/fbtft/flexfb.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index ded1071..7d2ffbb 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -27,40 +27,40 @@
 #define DRVNAME"flexfb"
 
 static char *chip;
-module_param(chip, charp, 0);
+module_param(chip, charp, );
 MODULE_PARM_DESC(chip, "LCD controller");
 
 static unsigned int width;
-module_param(width, uint, 0);
+module_param(width, uint, );
 MODULE_PARM_DESC(width, "Display width");
 
 static unsigned int height;
-module_param(height, uint, 0);
+module_param(height, uint, );
 MODULE_PARM_DESC(height, "Display height");
 
 static s16 init[512];
 static int init_num;
-module_param_array(init, short, _num, 0);
+module_param_array(init, short, _num, );
 MODULE_PARM_DESC(init, "Init sequence");
 
 static unsigned int setaddrwin;
-module_param(setaddrwin, uint, 0);
+module_param(setaddrwin, uint, );
 MODULE_PARM_DESC(setaddrwin, "Which set_addr_win() implementation to use");
 
 static unsigned int buswidth = 8;
-module_param(buswidth, uint, 0);
+module_param(buswidth, uint, );
 MODULE_PARM_DESC(buswidth, "Width of databus (default: 8)");
 
 static unsigned int regwidth = 8;
-module_param(regwidth, uint, 0);
+module_param(regwidth, uint, );
 MODULE_PARM_DESC(regwidth, "Width of controller register (default: 8)");
 
 static bool nobacklight;
-module_param(nobacklight, bool, 0);
+module_param(nobacklight, bool, );
 MODULE_PARM_DESC(nobacklight, "Turn off backlight functionality.");
 
 static bool latched;
-module_param(latched, bool, 0);
+module_param(latched, bool, );
 MODULE_PARM_DESC(latched, "Use with latched 16-bit databus");
 
 static s16 *initp;
-- 
2.5.5



[PATCH] staging: fbtft: replace decimal with 4-digit octal permissions

2017-01-17 Thread Stefano Manni
Following error detected by checkpatch.pl:

ERROR: Use 4 digit octal (0777) not decimal permissions

Signed-off-by: Stefano Manni 
---
 drivers/staging/fbtft/flexfb.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index ded1071..7d2ffbb 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -27,40 +27,40 @@
 #define DRVNAME"flexfb"
 
 static char *chip;
-module_param(chip, charp, 0);
+module_param(chip, charp, );
 MODULE_PARM_DESC(chip, "LCD controller");
 
 static unsigned int width;
-module_param(width, uint, 0);
+module_param(width, uint, );
 MODULE_PARM_DESC(width, "Display width");
 
 static unsigned int height;
-module_param(height, uint, 0);
+module_param(height, uint, );
 MODULE_PARM_DESC(height, "Display height");
 
 static s16 init[512];
 static int init_num;
-module_param_array(init, short, _num, 0);
+module_param_array(init, short, _num, );
 MODULE_PARM_DESC(init, "Init sequence");
 
 static unsigned int setaddrwin;
-module_param(setaddrwin, uint, 0);
+module_param(setaddrwin, uint, );
 MODULE_PARM_DESC(setaddrwin, "Which set_addr_win() implementation to use");
 
 static unsigned int buswidth = 8;
-module_param(buswidth, uint, 0);
+module_param(buswidth, uint, );
 MODULE_PARM_DESC(buswidth, "Width of databus (default: 8)");
 
 static unsigned int regwidth = 8;
-module_param(regwidth, uint, 0);
+module_param(regwidth, uint, );
 MODULE_PARM_DESC(regwidth, "Width of controller register (default: 8)");
 
 static bool nobacklight;
-module_param(nobacklight, bool, 0);
+module_param(nobacklight, bool, );
 MODULE_PARM_DESC(nobacklight, "Turn off backlight functionality.");
 
 static bool latched;
-module_param(latched, bool, 0);
+module_param(latched, bool, );
 MODULE_PARM_DESC(latched, "Use with latched 16-bit databus");
 
 static s16 *initp;
-- 
2.5.5