[PATCH net-next v3 1/2] net: phy: mscc: fix signedness bug in vsc85xx_downshift_get

2018-10-16 Thread Gustavo A. R. Silva
("Unsigned compared against 0") Fixes: 6a0bfbbe20b0 ("net: phy: mscc: migrate to phy_select/restore_page functions") Reviewed-by: Quentin Schulz Signed-off-by: Gustavo A. R. Silva --- Changes in v3: - Post patch to netdev. Changes in v2: - Add Quentin's Reviewed-by to the commi

[PATCH] rds: send: Fix dead code in rds_sendmsg

2018-07-25 Thread Gustavo A. R. Silva
DS IPv6 support") Signed-off-by: Gustavo A. R. Silva --- net/rds/send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/rds/send.c b/net/rds/send.c index 9604e1f..18e2b4d 100644 --- a/net/rds/send.c +++ b/net/rds/send.c @@ -1126,7 +1126,7 @@ int rds_sendmsg(struct

[PATCH] net: sched: cls_api: fix dead code in switch

2018-07-25 Thread Gustavo A. R. Silva
Code at line 1850 is unreachable. Fix this by removing the break statement above it, so the code for case RTM_GETCHAIN can be properly executed. Addresses-Coverity-ID: 1472050 ("Structurally dead code") Fixes: 32a4f5ecd738 ("net: sched: introduce chain object to uapi") Signed-

Re: [PATCH] ptp: fix missing break in switch

2018-07-18 Thread Gustavo A. R. Silva
On 07/18/2018 05:26 PM, David Miller wrote: > From: "Gustavo A. R. Silva" > Date: Tue, 17 Jul 2018 20:17:33 -0500 > >> It seems that a *break* is missing in order to avoid falling through >> to the default case. Otherwise, checking *chan* makes no sense. >>

[PATCH] mwifiex: mark expected switch fall-throughs

2018-05-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 drivers/net/wireless/marvell/mwifiex/scan.c | 1 + 2

[PATCH] ath9k: mark expected switch fall-throughs

2018-05-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/ath/ath9k/ar5008_phy.c | 2 ++ drivers/net/wireless/ath/ath9k/ar9002_phy.c | 1 + drivers/net/wi

Re: [PATCH v2] ath6kl: mark expected switch fall-throughs

2018-05-25 Thread Gustavo A. R. Silva
On 05/25/2018 01:27 PM, Steve deRosier wrote: On Fri, May 25, 2018 at 11:23 AM Gustavo A. R. Silva <gust...@embeddedor.com> wrote: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva

[PATCH v2] ath6kl: mark expected switch fall-throughs

2018-05-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Place code comments on a line of their own. drivers/net/wireless/ath/ath6kl/cfg80211.c | 3 +++

Re: [PATCH] ath6kl: mark expected switch fall-throughs

2018-05-25 Thread Gustavo A. R. Silva
On 05/25/2018 01:10 PM, Kalle Valo wrote: Yeah, I was wondering the same. Was there a particular reason for this? Sometimes people use this style for a one-line code block. I can change it to the traditional style. No problem. I would prefer that. So if you can send v2 that would be

Re: [PATCH] ath6kl: mark expected switch fall-throughs

2018-05-25 Thread Gustavo A. R. Silva
On 05/25/2018 08:30 AM, Kalle Valo wrote: Sergei Shtylyov <sergei.shtyl...@cogentembedded.com> writes: On 5/25/2018 2:13 AM, Gustavo A. R. Silva wrote: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustav

[PATCH] ath6kl: mark expected switch fall-throughs

2018-05-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH] ath10k: htt_tx: mark expected switch fall-throughs

2018-05-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Notice that in this particular case, I replaced "pass through" with a proper "fall through" comment, which is what GCC is expecting to find. Signed-off-by: Gusta

[PATCH] ath5k: mark expected switch fall-through

2018-05-24 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/ath/ath5k/pcu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath

Re: [PATCH] rtlwifi: remove duplicate code

2018-05-24 Thread Gustavo A. R. Silva
Hi Joe, On 05/24/2018 02:24 PM, Joe Perches wrote: On Thu, 2018-05-24 at 13:54 -0500, Gustavo A. R. Silva wrote: Remove and refactor some code in order to avoid having identical code for different branches. True and nice tool and patch submittal thanks. Notice that the logic has been

[PATCH] rtlwifi: remove duplicate code

2018-05-24 Thread Gustavo A. R. Silva
Remove and refactor some code in order to avoid having identical code for different branches. Notice that the logic has been there since 2014. Addresses-Coverity-ID: 1426199 ("Identical code for different branches") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com>

Re: [PATCH 1/2] bpf: sockmap, double free in __sock_map_ctx_update_elem()

2018-05-18 Thread Gustavo A. R. Silva
Hi Dan, On 05/18/2018 09:39 AM, Dan Carpenter wrote: On Fri, May 18, 2018 at 10:27:18AM +0200, Daniel Borkmann wrote: Thanks for the two fixes, appreciate it! There were two similar ones that fix the same issues which were already applied yesterday to bpf-next:

Re: [PATCH 0/2] bpf: sockmap, fix uninitialized variable and double-free

2018-05-17 Thread Gustavo A. R. Silva
Hi Daniel, On 05/17/2018 03:51 PM, Daniel Borkmann wrote: On 05/17/2018 04:04 PM, Gustavo A. R. Silva wrote: This patchset aims to fix an uninitialized variable issue and a double-free issue in __sock_map_ctx_update_elem. Both issues were reported by Coverity. Thanks. Gustavo A. R. Silva (2

Re: [PATCH 1/2] bpf: sockmap, fix uninitialized variable

2018-05-17 Thread Gustavo A. R. Silva
Hi John, On 05/17/2018 12:27 PM, John Fastabend wrote: On 05/17/2018 07:08 AM, Gustavo A. R. Silva wrote: There is a potential execution path in which variable err is returned without being properly initialized previously. Fix this by initializing variable err to 0. Addresses-Coverity-ID

[PATCH 2/2] bpf: sockmap, fix double-free

2018-05-17 Thread Gustavo A. R. Silva
`e' is being freed twice. Fix this by removing one of the kfree() calls. Addresses-Coverity-ID: 1468983 ("Double free") Fixes: 81110384441a ("bpf: sockmap, add hash map support") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- kernel/bpf/sockmap.

[PATCH 1/2] bpf: sockmap, fix uninitialized variable

2018-05-17 Thread Gustavo A. R. Silva
outines to work with hashmap") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- kernel/bpf/sockmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index c6de139..41b41fc 100644 --- a/kernel/bpf/sockmap.c

[PATCH 0/2] bpf: sockmap, fix uninitialized variable and double-free

2018-05-17 Thread Gustavo A. R. Silva
This patchset aims to fix an uninitialized variable issue and a double-free issue in __sock_map_ctx_update_elem. Both issues were reported by Coverity. Thanks. Gustavo A. R. Silva (2): bpf: sockmap, fix uninitialized variable bpf: sockmap, fix double-free kernel/bpf/sockmap.c | 3 +-- 1

[PATCH] net: atm: Fix potential Spectre v1

2018-05-03 Thread Gustavo A. R. Silva
on the first load and not worry if it can be completed with a dependent load/store [1]. [1] https://marc.info/?l=linux-kernel=152449131114778=2 Cc: sta...@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/atm/lec.c | 9 +++-- 1 file changed, 7 inse

[PATCH] atm: zatm: Fix potential Spectre v1

2018-05-03 Thread Gustavo A. R. Silva
=2 Cc: sta...@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/atm/zatm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c index 1ef67db..9c9a229 100644 --- a/drivers/atm/zatm.c +++ b/drivers/atm/zatm.c @@

[PATCH] rsi_91x_usb: fix uninitialized variable

2018-04-26 Thread Gustavo A. R. Silva
2f37 ("rsi: disable fw watchdog timer during reset") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/rsi/rsi_91x_usb.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c

[PATCH] rsi_91x_mac80211: fix structurally dead code

2018-04-26 Thread Gustavo A. R. Silva
ot;) Fixes: 4fd6c4762f37 ("rsi: roaming enhancements") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x

Re: [PATCH v2] net: thunderx: rework mac addresses list to u64 array

2018-04-06 Thread Gustavo A. R. Silva
On 04/06/2018 06:43 AM, Vadim Lomovtsev wrote: Hi Gustavo, On Fri, Apr 06, 2018 at 06:36:28AM -0500, Gustavo A. R. Silva wrote: Hi Vadim, On 04/06/2018 06:14 AM, Vadim Lomovtsev wrote: From: Vadim Lomovtsev <vadim.lomovt...@cavium.com> It is too expensive to pass u64 values via

Re: [PATCH v2] net: thunderx: rework mac addresses list to u64 array

2018-04-06 Thread Gustavo A. R. Silva
mplementation for VF") It'd be nice if you add: Reported-by: Gustavo A. R. Silva <gust...@embeddedor.com> Thanks -- Gustavo Signed-off-by: Vadim Lomovtsev <vadim.lomovt...@cavium.com> --- Changes from v1 to v2: - C99 syntax: update xcast_addr_list struct field mc[0] ->

Re: [PATCH] qtnfmac: pearl: pcie: fix memory leak in qtnf_fw_work_handler

2018-04-05 Thread Gustavo A. R. Silva
ronous firmware loading") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 4 1 file changed, 4 insertions(+) Thanks for the patch! Glad to help. :) Reviewed-by: Sergey Matyukevich <sergey.matyukevic

[PATCH] ieee802154: mcr20a: Fix memory leak in mcr20a_probe

2018-04-05 Thread Gustavo A. R. Silva
Free allocated memory for pdata before return. Addresses-Coverity-ID: 1466096 ("Resource leak") Fixes: 8c6ad9cc5157 ("ieee802154: Add NXP MCR20A IEEE 802.15.4 transceiver driver") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/ieee802154

[PATCH] qtnfmac: pearl: pcie: fix memory leak in qtnf_fw_work_handler

2018-04-05 Thread Gustavo A. R. Silva
In case memory resources for fw were succesfully allocated, release them before jumping to fw_load_fail. Addresses-Coverity-ID: 1466092 ("Resource leak") Fixes: c3b2f7ca4186 ("qtnfmac: implement asynchronous firmware loading") Signed-off-by: Gustavo A. R. Silva <

Re: [PATCH v2] Bluetooth: Remove VLA usage in aes_cmac

2018-04-05 Thread Gustavo A. R. Silva
On 04/05/2018 03:46 AM, Marcel Holtmann wrote: By the way, what is you opinion on replacing crypto_shash_descsize(ctx) with PAGE_SIZE / 8 in SHASH_DESC_ON_STACK? Does it work for you? isn’t that just waste? Agree. The macro itself is this. #define SHASH_DESC_ON_STACK(shash, ctx)

Re: [PATCH v2] Bluetooth: Remove VLA usage in aes_cmac

2018-04-05 Thread Gustavo A. R. Silva
Hi Marcel, On 04/05/2018 02:23 AM, Marcel Holtmann wrote: so I took this patch back out of bluetooth-next before sending the pull request. I think the discussion on how to fix SHASH_DESC_ON_STACK macro needs to complete first. Once that has concluded we can revisit if this patch is still

[rtlwifi-btcoex] Suspicious code in halbtc8821a1ant driver

2018-04-04 Thread Gustavo A. R. Silva
Hi all, While doing some static analysis I came across the following piece of code at drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c:1581: 1581 static void btc8821a1ant_act_bt_sco_hid_only_busy(struct btc_coexist *btcoexist, 1582

[PATCH] brcm80211: brcmsmac: phy_lcn: remove duplicate code

2018-04-04 Thread Gustavo A. R. Silva
Remove and refactor some code in order to avoid having identical code for different branches. Notice that this piece of code hasn't been modified since 2011. Addresses-Coverity-ID: 1226756 ("Identical code for different branches") Signed-off-by: Gustavo A. R. Silva <gust...@e

Re: [PATCH v2] net: thunderx: nicvf_main: Fix potential NULL pointer dereferences

2018-04-04 Thread Gustavo A. R. Silva
On 04/04/2018 01:36 AM, Eric Dumazet wrote: On 04/03/2018 03:04 PM, Gustavo A. R. Silva wrote: Add null check on kmalloc() return value in order to prevent a null pointer dereference. Addresses-Coverity-ID: 1467429 ("Dereference null return value") Fixes: 37c3347eb247 ("net

[PATCH v2] net: thunderx: nicvf_main: Fix potential NULL pointer dereferences

2018-04-03 Thread Gustavo A. R. Silva
Add null check on kmalloc() return value in order to prevent a null pointer dereference. Addresses-Coverity-ID: 1467429 ("Dereference null return value") Fixes: 37c3347eb247 ("net: thunderx: add ndo_set_rx_mode callback implementation for VF") Signed-off-by: Gusta

Re: [PATCH] net: thunderx: nicvf_main: Fix potential NULL pointer dereference

2018-04-03 Thread Gustavo A. R. Silva
On 04/03/2018 04:47 PM, Eric Dumazet wrote: On 04/03/2018 02:29 PM, Gustavo A. R. Silva wrote: Add null check on kmalloc() return value in order to prevent a null pointer dereference. Addresses-Coverity-ID: 1467429 ("Dereference null return value") Fixes: 37c3347eb247 ("net

[PATCH] net: thunderx: nicvf_main: Fix potential NULL pointer dereference

2018-04-03 Thread Gustavo A. R. Silva
Add null check on kmalloc() return value in order to prevent a null pointer dereference. Addresses-Coverity-ID: 1467429 ("Dereference null return value") Fixes: 37c3347eb247 ("net: thunderx: add ndo_set_rx_mode callback implementation for VF") Signed-off-by: Gusta

[PATCH] mt7601u: phy: mark expected switch fall-through

2018-03-30 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/mediatek/mt7601u/phy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wi

[PATCH] Bluetooth: Mark expected switch fall-throughs

2018-03-30 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/bluetooth/mgmt.c| 1 + net/bluetooth/rfcomm/sock.c | 1 + 2 files changed, 2 insertions(+) diff --git

[PATCH] ath9k: dfs: remove accidental use of stack VLA

2018-03-30 Thread Gustavo A. R. Silva
e all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/wireless/ath/ath9k/dfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wi

Re: [PATCH] ISDN: eicon: message: remove redundant check

2018-03-30 Thread Gustavo A. R. Silva
On 03/30/2018 11:19 AM, Joe Perches wrote: On Fri, 2018-03-30 at 10:46 -0500, Gustavo A. R. Silva wrote: Check on plci->internal_command is unnecessary. Probably all of these are unnecessary too: $ for length in {7..2} ; do \ grep-2.5.4 -rP --include=*.[ch] -n "^\t{$length

[PATCH] ISDN: eicon: message: remove redundant check

2018-03-30 Thread Gustavo A. R. Silva
Check on plci->internal_command is unnecessary. Addresses-Coverity-ID: 1268778 ("Identical code for different branches") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/isdn/hardware/eicon/message.c | 2 -- 1 file changed, 2 deletions(-) diff -

[PATCH] qed: Use true and false for boolean values

2018-03-22 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/ethernet/qlogic/qed/qed_dev.c | 10 +- 1 file changed, 5 insertions(+), 5 del

[PATCH] dpaa_eth: use true and false for boolean values

2018-03-22 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 de

Re: [PATCH] caif_dev: use true and false for boolean values

2018-03-22 Thread Gustavo A. R. Silva
Hi all, I was just wondering about the status of this patch. Thanks! -- Gustavo On 03/05/2018 04:05 PM, Gustavo A. R. Silva wrote: Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva

[PATCH v2] net/mlx5: Fix use-after-free

2018-03-22 Thread Gustavo A. R. Silva
ot;net/mlx5: Add flow-steering commands for FPGA IPSec implementation") Reviewed-by: Yuval Shaia <yuval.sh...@oracle.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Use a short subject prefix as suggested by Yuval Shaia. - Add Yuval's Reviewed-by

Re: [PATCH] net/mlx5/core/fpga/ipsec: Fix use-after-free

2018-03-22 Thread Gustavo A. R. Silva
Hi Yuval, On 03/22/2018 01:32 PM, Yuval Shaia wrote: On Thu, Mar 22, 2018 at 01:03:42PM -0500, Gustavo A. R. Silva wrote: _rule_ is being freed and then dereferenced by accessing rule->ctx Fix this by copying the value returned by PTR_ERR(rule->ctx) into a local variable for its sa

[PATCH] net/mlx5/core/fpga/ipsec: Fix use-after-free

2018-03-22 Thread Gustavo A. R. Silva
ot;net/mlx5: Add flow-steering commands for FPGA IPSec implementation") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/m

Re: [PATCH v2] Bluetooth: Remove VLA usage in aes_cmac

2018-03-21 Thread Gustavo A. R. Silva
-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: - Fix memory leak in previous patch. net/bluetooth/smp.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel Awesome. Thanks,

Re: [PATCH] mac80211: aes-cmac: remove VLA usage

2018-03-21 Thread Gustavo A. R. Silva
On 03/21/2018 08:58 AM, Johannes Berg wrote: On Wed, 2018-03-21 at 08:57 -0500, Gustavo A. R. Silva wrote: SHA_DESC_ON_STACK is currently being used in multiple places. But, yeah, I think we can define multiple macros of the same kind and adjust to the characteristics of each the component

Re: [PATCH] mac80211: aes-cmac: remove VLA usage

2018-03-21 Thread Gustavo A. R. Silva
On 03/21/2018 08:48 AM, Johannes Berg wrote: On Wed, 2018-03-21 at 08:42 -0500, Gustavo A. R. Silva wrote: In preparation to enabling -Wvla, remove VLAs and replace them with dynamic memory allocation instead. The use of stack Variable Length Arrays needs to be avoided, as they can

Re: [PATCH] netfilter: nfnetlink_cthelper: Remove VLA usage

2018-03-21 Thread Gustavo A. R. Silva
On 03/20/2018 07:36 AM, Pablo Neira Ayuso wrote: On Mon, Mar 12, 2018 at 07:21:38PM -0500, Gustavo A. R. Silva wrote: In preparation to enabling -Wvla, remove VLA and replace it with dynamic memory allocation. From a security viewpoint, the use of Variable Length Arrays can be a vector

[PATCH] mac80211: aes-cmac: remove VLA usage

2018-03-21 Thread Gustavo A. R. Silva
it is easy to lose track of how big a VLA can get. Thus, we can end up having runtime failures that are hard to debug. Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --

Re: [PATCH] Bluetooth: Remove VLA usage in aes_cmac

2018-03-20 Thread Gustavo A. R. Silva
Hi, I've just discovered an issue in this patch. Please, drop it. I'll send v2 shortly. Thanks -- Gustavo On 03/20/2018 06:34 PM, Gustavo A. R. Silva wrote: In preparation to enabling -Wvla, remove VLA and replace it with dynamic memory allocation instead. The use of stack Variable Length

[PATCH v2] Bluetooth: Remove VLA usage in aes_cmac

2018-03-20 Thread Gustavo A. R. Silva
it is easy to lose track of how big a VLA can get. Thus, we can end up having runtime failures that are hard to debug. Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- C

[PATCH] Bluetooth: Remove VLA usage in aes_cmac

2018-03-20 Thread Gustavo A. R. Silva
it is easy to lose track of how big a VLA can get. Thus, we can end up having runtime failures that are hard to debug. Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --

Re: [PATCH] pktgen: use dynamic allocation for debug print buffer

2018-03-14 Thread Gustavo A. R. Silva
Arnd: Thanks for the fix. On 03/13/2018 10:02 PM, Wang Jian wrote: + kfree(buf); free tb? buf is an array. Wang: Thanks for the report. I already sent a patch to fix this: https://patchwork.kernel.org/patch/10281587/ -- Gustavo On Wed, Mar 14, 2018 at 8:25 AM, David Miller

[PATCH] pktgen: Fix memory leak in pktgen_if_write

2018-03-14 Thread Gustavo A. R. Silva
_buf_ is an array and the one that must be freed is _tp_ instead. Fixes: a870a02cc963 ("pktgen: use dynamic allocation for debug print buffer") Reported-by: Wang Jian <jianjian.wa...@gmail.com> Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/core/p

Re: linux-next: build warning after merge of the net-next tree

2018-03-13 Thread Gustavo A. R. Silva
On 03/13/2018 10:33 AM, David Miller wrote: From: "Gustavo A. R. Silva" <gust...@embeddedor.com> Date: Tue, 13 Mar 2018 06:46:24 -0500 Hi Stephen, On 03/13/2018 01:11 AM, Stephen Rothwell wrote: Hi all, After merging the net-next tree, today's linux-next build (sparc def

Re: linux-next: build warning after merge of the net-next tree

2018-03-13 Thread Gustavo A. R. Silva
Hi Stephen, On 03/13/2018 01:11 AM, Stephen Rothwell wrote: Hi all, After merging the net-next tree, today's linux-next build (sparc defconfig) produced this warning: net/core/pktgen.c: In function 'pktgen_if_write': net/core/pktgen.c:1710:1: warning: the frame size of 1048 bytes is larger

[PATCH v2] netfilter: nf_tables: remove VLA usage

2018-03-12 Thread Gustavo A. R. Silva
we can end up having segfaults that are hard to debug. Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- Changes in v2: - Use kmalloc_array instead of kcalloc. net/

[PATCH] netfilter: nf_tables: remove VLA usage

2018-03-12 Thread Gustavo A. R. Silva
we can end up having segfaults that are hard to debug. Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/netfilter/nf_tables_api.c | 23 +++ 1 fil

[PATCH] netfilter: nfnetlink_cthelper: Remove VLA usage

2018-03-12 Thread Gustavo A. R. Silva
we can end up having segfaults that are hard to debug. Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/netfilter/nfnetlink_cthelper.c | 25 +---

[PATCH] netfilter: cttimeout: remove VLA usage

2018-03-12 Thread Gustavo A. R. Silva
we can end up having segfaults that are hard to debug. Also, fixed as part of the directive to remove all VLAs from the kernel: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/netfilter/nfnetlink_cttimeout.c | 26 +---

Re: [RFC] netfilter: cttimeout: remove VLA in ctnl_timeout_parse_policy

2018-03-11 Thread Gustavo A. R. Silva
On 03/11/2018 05:21 PM, Pablo Neira Ayuso wrote: On Sun, Mar 11, 2018 at 05:12:09PM -0500, Gustavo A. R. Silva wrote: Hi Pablo, On 03/11/2018 05:04 PM, Pablo Neira Ayuso wrote: On Tue, Mar 06, 2018 at 12:47:55PM -0600, Gustavo A. R. Silva wrote: In preparation to enabling -Wvla, remove VLA

Re: [RFC] netfilter: cttimeout: remove VLA in ctnl_timeout_parse_policy

2018-03-11 Thread Gustavo A. R. Silva
Hi Pablo, On 03/11/2018 05:04 PM, Pablo Neira Ayuso wrote: On Tue, Mar 06, 2018 at 12:47:55PM -0600, Gustavo A. R. Silva wrote: In preparation to enabling -Wvla, remove VLA and replace it with dynamic memory allocation. Looks good but... Signed-off-by: Gustavo A. R. Silva <g

Re: [PATCH] drivers: net: wireless: ath: ath9: dfs: remove VLA usage

2018-03-10 Thread Gustavo A. R. Silva
On 03/10/2018 05:12 PM, Kees Cook wrote: On Sat, Mar 10, 2018 at 3:06 PM, Arend van Spriel wrote: On 3/9/2018 1:30 PM, Andreas Christoforou wrote: The kernel would like to have all stack VLA usage removed. I think there was a remark made earlier to give

Re: [PATCH] pktgen: Remove VLA usage

2018-03-09 Thread Gustavo A. R. Silva
On 03/09/2018 10:58 AM, David Miller wrote: From: "Gustavo A. R. Silva" <gust...@embeddedor.com> Date: Thu, 8 Mar 2018 23:43:40 -0600 In preparation to enabling -Wvla, remove VLA usage and replace it with a fixed-length array instead. Signed-off-by: Gustavo A

[PATCH] pktgen: Remove VLA usage

2018-03-08 Thread Gustavo A. R. Silva
In preparation to enabling -Wvla, remove VLA usage and replace it with a fixed-length array instead. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- David, I'm not sure how often this function is being called and, depending on the frequency it may be worth to use dynamic

[RFC] Removing VLA usage in l1oip_core

2018-03-08 Thread Gustavo A. R. Silva
Hi Karsten, I'm trying to figure out the best way to fix the following VLA warning: drivers/isdn/mISDN/l1oip_core.c:282:2: warning: ISO C90 forbids variable length array ‘frame’ [-Wvla] u8 frame[len + 32]; ^~ So while doing some research I've found the following. Based on this code at

[PATCH v2] cxgb3: remove VLA usage

2018-03-07 Thread Gustavo A. R. Silva
Remove VLA usage and change the 'len' argument to a u8 and use a 256 byte buffer on the stack. Notice that these lengths are limited by the encoding field in the VPD structure, which is a u8 [1]. [1] https://marc.info/?l=linux-netdev=152044354814024=2 Signed-off-by: Gustavo A. R. Silva <g

Re: [PATCH] cxgb3: remove VLA

2018-03-07 Thread Gustavo A. R. Silva
On 03/07/2018 11:25 AM, David Miller wrote: From: "Gustavo A. R. Silva" <gust...@embeddedor.com> Date: Mon, 5 Mar 2018 23:39:34 -0600 In preparation to enabling -Wvla, remove VLA and replace it with dynamic memory allocation. Signed-off-by: Gustavo A. R. Silva <gust...@em

[RFC] netfilter: cttimeout: remove VLA in ctnl_timeout_parse_policy

2018-03-06 Thread Gustavo A. R. Silva
In preparation to enabling -Wvla, remove VLA and replace it with dynamic memory allocation. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/netfilter/nfnetlink_cttimeout.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net/net

[PATCH] cxgb3: remove VLA

2018-03-05 Thread Gustavo A. R. Silva
In preparation to enabling -Wvla, remove VLA and replace it with dynamic memory allocation. Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff

[PATCH] caif_dev: use true and false for boolean values

2018-03-05 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- net/caif/caif_dev.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ne

Re: [PATCH] netfilter: ipt_ah: return boolean instead of integer

2018-03-05 Thread Gustavo A. R. Silva
On 03/05/2018 04:10 PM, Pablo Neira Ayuso wrote: On Tue, Feb 13, 2018 at 08:25:57AM -0600, Gustavo A. R. Silva wrote: Return statements in functions returning bool should use true/false instead of 1/0. This issue was detected with the help of Coccinelle. This one didn't get in time

[PATCH] tipc: bcast: use true and false for boolean values

2018-03-05 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- net/tipc/bcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/tipc/bca

[PATCH] xfrm_policy: use true and false for boolean values

2018-03-05 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- net/xfrm/xfrm_policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ne

[PATCH] ipv6: ndisc: use true and false for boolean values

2018-03-05 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- net/ipv6/ndisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/ndi

[PATCH] ipvs: use true and false for boolean values

2018-03-05 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- net/netfilter/ipvs/ip_vs_lblc.c | 4 ++-- net/netfilter/ipvs/ip_vs_lblcr.c | 4 ++-- 2 files chan

Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size

2018-02-20 Thread Gustavo A. R. Silva
Hi Santosh, On 02/20/2018 11:54 AM, Santosh Shilimkar wrote: Hi, 2/19/2018 10:10 AM, Gustavo A. R. Silva wrote: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1465362 ("Missing break in switch")

Re: [PATCH] rds: send: mark expected switch fall-through in rds_rm_size

2018-02-20 Thread Gustavo A. R. Silva
On 02/20/2018 12:01 PM, David Miller wrote: From: Santosh Shilimkar Date: Tue, 20 Feb 2018 09:54:09 -0800 So coverity greps for commet as "fall through" for -Wimplicit-fallthrough build ? From what I understand, 'gcc' does in the latest versions. Coverity

[PATCH] rds: send: mark expected switch fall-through in rds_rm_size

2018-02-19 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1465362 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/rds/send.c | 2 ++ 1 file changed, 2 ins

[PATCH] net: dsa: mv88e6xxx: hwtstamp: remove unnecessary range checking tests

2018-02-16 Thread Gustavo A. R. Silva
_port_ is already known to be a valid index in the callers [1]. So these checks are unnecessary. [1] https://lkml.org/lkml/2018/2/16/469 Addresses-Coverity-ID: 1465287 Addresses-Coverity-ID: 1465291 Suggested-by: Richard Cochran <richardcoch...@gmail.com> Signed-off-by: Gustavo A. R. Silva

Re: [PATCH v2] net: dsa: mv88e6xxx: hwtstamp: fix potential negative array index read

2018-02-16 Thread Gustavo A. R. Silva
On 02/16/2018 09:56 AM, Richard Cochran wrote: On Fri, Feb 16, 2018 at 07:48:46AM -0800, Richard Cochran wrote: On Thu, Feb 15, 2018 at 12:31:39PM -0600, Gustavo A. R. Silva wrote: _port_ is being used as index to array port_hwtstamp before verifying it is a non-negative number and a valid

Re: [PATCH] i40evf/i40evf_main: Fix variable assignment in i40evf_parse_cls_flower

2018-02-15 Thread Gustavo A. R. Silva
On 02/15/2018 12:11 PM, Jeff Kirsher wrote: On Thu, 2018-02-15 at 09:56 -0800, Ramamurthy, Harshitha wrote: On Thu, 2018-02-15 at 11:44 -0600, Gustavo A. R. Silva wrote: It seems this is a copy-paste error and that the proper variable to use in this particular case is _src_ instead of _dst_

[PATCH] net: dsa: mv88e6xxx: hwtstamp: fix potential negative array index read

2018-02-15 Thread Gustavo A. R. Silva
ot;Negative array index read") Fixes: c6fe0ad2c349 ("net: dsa: mv88e6xxx: add rx/tx timestamping support") Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- drivers/net/dsa/mv88e6xxx/hwtstamp.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff -

[PATCH v2] net: dsa: mv88e6xxx: hwtstamp: fix potential negative array index read

2018-02-15 Thread Gustavo A. R. Silva
465287 ("Negative array index read") Addresses-Coverity-ID: 1465291 ("Negative array index read") Fixes: c6fe0ad2c349 ("net: dsa: mv88e6xxx: add rx/tx timestamping support") Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- Changes in v2: -Fix

[PATCH] i40evf/i40evf_main: Fix variable assignment in i40evf_parse_cls_flower

2018-02-15 Thread Gustavo A. R. Silva
It seems this is a copy-paste error and that the proper variable to use in this particular case is _src_ instead of _dst_. Addresses-Coverity-ID: 1465282 ("Copy-paste error") Fixes: 0075fa0fadd0 ("i40evf: Add support to apply cloud filters") Signed-off-by: Gustav

[PATCH] netfilter: ipt_ah: return boolean instead of integer

2018-02-13 Thread Gustavo A. R. Silva
Return statements in functions returning bool should use true/false instead of 1/0. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> --- net/ipv4/netfilter/ipt_ah.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH] atm: he: use 64-bit arithmetic instead of 32-bit

2018-02-07 Thread Gustavo A. R. Silva
being evaluated using 32-bit arithmetic: 272 * mult 204 * mult 136 * mult 68 * mult Addresses-Coverity-ID: 201058 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- drivers/atm/he.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/atm/he.c b/d

Re: [PATCH] tcp_lp: use 64-bit arithmetic instead of 32-bit

2018-02-01 Thread Gustavo A. R. Silva
Hi Andrew, Quoting Andrew Lunn <and...@lunn.ch>: On Wed, Jan 31, 2018 at 07:07:49PM -0600, Gustavo A. R. Silva wrote: Hi Alan, Quoting Alan Cox <gno...@lxorguk.ukuu.org.uk>: >On Wed, 31 Jan 2018 18:24:07 -0600 >"Gustavo A. R. Silva" <gust...@embeddedor.c

Re: [PATCH] tcp_lp: use 64-bit arithmetic instead of 32-bit

2018-02-01 Thread Gustavo A. R. Silva
Hi David, Quoting David Miller <da...@davemloft.net>: From: "Gustavo A. R. Silva" <gust...@embeddedor.com> Date: Wed, 31 Jan 2018 18:24:07 -0600 Cast to s64 some variables and a macro in order to give the compiler complete information about the proper ari

Re: [PATCH] tcp_lp: use 64-bit arithmetic instead of 32-bit

2018-02-01 Thread Gustavo A. R. Silva
Hi David, Quoting David Laight : > The question you need to ask is 'can it overflow 32bit maths', otherwise > you are potentially making the system do extra work for no reason. > Yeah, I get your point and it seems that in this particular case there is no risk of a

Re: [PATCH] tcp_lp: use 64-bit arithmetic instead of 32-bit

2018-01-31 Thread Gustavo A. R. Silva
Hi Alan, Quoting Alan Cox <gno...@lxorguk.ukuu.org.uk>: On Wed, 31 Jan 2018 18:24:07 -0600 "Gustavo A. R. Silva" <gust...@embeddedor.com> wrote: Cast to s64 some variables and a macro in order to give the compiler complete information about the proper ari

[PATCH] tcp_lp: use 64-bit arithmetic instead of 32-bit

2018-01-31 Thread Gustavo A. R. Silva
arithmetic. Addresses-Coverity-ID: 200687 Addresses-Coverity-ID: 200688 Addresses-Coverity-ID: 200689 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/ipv4/tcp_lp.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c

Re: [PATCH] libceph: use 64-bit arithmetic instead of 32-bit

2018-01-31 Thread Gustavo A. R. Silva
Hello Ilya, Quoting Ilya Dryomov <idryo...@gmail.com>: On Wed, Jan 31, 2018 at 6:29 AM, Gustavo A. R. Silva <gust...@embeddedor.com> wrote: Cast objsetno to u64 in order to give the compiler complete information about the proper arithmetic to use. Notice that this vari

[PATCH] libceph: use 64-bit arithmetic instead of 32-bit

2018-01-30 Thread Gustavo A. R. Silva
arithmetic. In general, the use of incorrect arithmetic has security implications. Addresses-Coverity-ID: 200686 Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/ceph/osdmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/osdmap.c b/ne

[PATCH] openvswitch: meter: Use 64-bit arithmetic instead of 32-bit

2018-01-30 Thread Gustavo A. R. Silva
* 1000 is currently being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1461563 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gust...@embeddedor.com> --- net/openvswitch/meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ope

  1   2   3   4   >