Re: [PATCH net-next 03/13] virtio_ring: packed: harden dma unmap for indirect

2024-08-21 Thread Dan Carpenter
in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Reported-by: Dan Carpenter | Closes: https://lore.kernel.org/r/202408210655.dx8v5urw-...@intel.com/ New smatch warnings: drivers/virtio/virtio_ring.c

Re: [PATCH vhost 4/6] virtio_net: big mode support premapped

2024-04-14 Thread Dan Carpenter
/202404141343.iphko7zd-...@intel.com/config) compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Reported-by: Dan Carpenter | Closes: https

Re: [PATCH 2/2] virtio-net: reduce the CPU consumption of dim worker

2024-03-21 Thread Dan Carpenter
) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Reported-by: Dan Carpenter | Closes: https://lore.kernel.org/r/202403221133.j66ouezh

Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER

2021-04-20 Thread Dan Carpenter
true; > > return soc_dev; > > > > out3: > > @@ -246,6 +248,9 @@ const struct soc_device_attribute *soc_device_match( > > if (!matches) > > return NULL; > > > > + if (!soc_dev_attr_init_done && !early_soc_dev_attr) > > if (!soc_bus_type.p && !early_soc_dev_attr) There is one place checking this already. We could wrap it in a helper function: static bool device_init_done(void) { return soc_bus_type.p ? true : false; } regards, dan carpenter

Re: [PATCH][next] net: stmmac: replace redundant comparison with true

2021-04-15 Thread Dan Carpenter
On Thu, Apr 15, 2021 at 09:37:57AM +0100, Colin King wrote: > From: Colin Ian King > > The comparison of the u32 variable queue with <= zero is always true > since an unsigned can never be negative. Replace the conditional > check with the boolean true to simplify the code. The while loop > will

Re: [PATCH net-next v2 1/2] of: net: pass the dst buffer to of_get_mac_address()

2021-04-13 Thread Dan Carpenter
-20210406 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2069 axienet_probe() warn: passing a

[PATCH net-next] ionic: return -EFAULT if copy_to_user() fails

2021-04-13 Thread Dan Carpenter
The copy_to_user() function returns the number of bytes that it wasn't able to copy. We want to return -EFAULT to the user. Fixes: fee6efce565d ("ionic: add hw timestamp support files") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/pensando/ionic/ionic_phc.c | 4 +++- 1

[PATCH net-next] net: enetc: fix array underflow in error handling code

2021-04-09 Thread Dan Carpenter
This loop will try to unmap enetc_unmap_tx_buff[-1] and crash. Fixes: 9d2b68cc108d ("net: enetc: add support for XDP_REDIRECT") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/freescale/enetc/enetc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ne

[kbuild] Re: [PATCH net-next v2 1/2] of: net: pass the dst buffer to of_get_mac_address()

2021-04-09 Thread Dan Carpenter
/kernel/git/davem/net-next.git cc0626c2aaed8e475efdd85fa374b497a7192e35 config: x86_64-randconfig-m001-20210406 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter

[PATCH net-next] nfc: pn533: prevent potential memory corruption

2021-04-02 Thread Dan Carpenter
If the "type_a->nfcid_len" is too large then it would lead to memory corruption in pn533_target_found_type_a() when we do: memcpy(nfc_tgt->nfcid1, tgt_type_a->nfcid_data, nfc_tgt->nfcid1_len); Fixes: c3b1e1e8a76f ("NFC: Export NFCID1 from pn533&quo

Re: [PATCH v6 01/10] file: Export receive_fd() to modules

2021-03-31 Thread Dan Carpenter
t; binder_debug(BINDER_DEBUG_TRANSACTION, > "failed fd fixup txn %d fd %d\n", regards, dan carpenter

Re: [PATCH][next] mlxsw: spectrum_router: remove redundant initialization of variable force

2021-03-28 Thread Dan Carpenter
ruct mlxsw_sp > *mlxsw_sp, > { > u16 bucket_index = info->nh_res_bucket->bucket_index; > struct netlink_ext_ack *extack = info->extack; > - bool force = info->nh_res_bucket->force; > + bool force; > char ratr_pl_new[MLXSW_REG_RATR_LEN]; >

Re: [PATCH] bpf: remove redundant assignment of variable id

2021-03-28 Thread Dan Carpenter
ing us to do that but it's never going to happen... :P I do this for networking but it's a massive pain in the butt and I get it wrong 20% of the time. regards, dan carpenter

Re: [PATCH net-next 5/6] ethtool: fec: sanitize ethtool_fecparam->fec

2021-03-25 Thread Dan Carpenter
(attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: net/ethtool/ioctl.c:2589 ethtool_set_fecparam() warn: bitwise AND condition is false here vim +2589

[bug report] net: hns3: vf indexing in hclge_add_fd_entry()

2021-03-24 Thread Dan Carpenter
true; 9137 9138 return false; 9139 } Another thing that's not clear to me is how pci_num_vf() relates to this. I suspect that it is the same as hdev->num_vmdq_vport, but I can't be sure. regards, dan carpenter

Re: [PATCH] drivers: staging: qlge: Fixed an alignment issue.

2021-03-17 Thread Dan Carpenter
int qlge_adapter_down(struct qlge_adapter *qdev) > qlge_tx_ring_clean(qdev); > > /* Call netif_napi_del() from common point. > - */ > + */ This has already been fixed upstream. You should be working against linux-next or staging-next. https://lore.kernel.org/driverdev-devel/

Re: [PATCH net-next] net: dsa: sja1105: fix error return code in sja1105_cls_flower_add()

2021-03-16 Thread Dan Carpenter
rc = -EOPNOTSUPP; > goto out; Yep. The goto out is a do nothing goto and "forgot the error code" is the traditional bug introduced by do nothing gotos. Reviewed-by: Dan Carpenter regards, dan carpenter

[PATCH net] mptcp: fix bit MPTCP_PUSH_PENDING tests

2021-03-11 Thread Dan Carpenter
The MPTCP_PUSH_PENDING define is 6 and these tests should be testing if BIT(6) is set. Fixes: c2e6048fa1cf ("mptcp: fix race in release_cb") Signed-off-by: Dan Carpenter --- net/mptcp/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protoc

[PATCH net] octeontx2-af: cn10k: fix an array overflow in is_lmac_valid()

2021-03-02 Thread Dan Carpenter
The value of "lmac_id" can be controlled by the user and if it is larger then the number of bits in long then it reads outside the bitmap. The highest valid value is less than MAX_LMAC_PER_CGX (4). Fixes: 91c6945ea1f9 ("octeontx2-af: cn10k: Add RPM MAC support") Signed-o

Re: [PATCH mellanox-tree] net/mlx5: prevent an integer underflow in mlx5_perout_configure()

2021-03-01 Thread Dan Carpenter
On Mon, Mar 01, 2021 at 12:12:34PM +0200, Eran Ben Elisha wrote: > > > On 2/19/2021 11:57 AM, Dan Carpenter wrote: > > The value of "sec" comes from the user. Negative values will lead to > > shift wrapping inside the perout_conf_real_time() function a

Re: [PATCH v2 net-next] net: phy: icplus: call phy_restore_page() when phy_select_page() fails

2021-02-19 Thread Dan Carpenter
On Fri, Feb 19, 2021 at 11:46:23AM +0100, Michael Walle wrote: > Am 2021-02-19 11:10, schrieb Dan Carpenter: > > The comments to phy_select_page() say that "phy_restore_page() must > > always be called after this, irrespective of success or failure of this > >

[PATCH v2 net-next] net: phy: icplus: call phy_restore_page() when phy_select_page() fails

2021-02-19 Thread Dan Carpenter
s: 32ab60e53920 ("net: phy: icplus: add MDI/MDIX support for IP101A/G") Fixes: f9bc51e6cce2 ("net: phy: icplus: fix paged register access") Signed-off-by: Dan Carpenter --- v2: fix a couple other instances I missed in v1 drivers/net/phy/icplus.c | 9 + 1 file changed, 5

[PATCH mellanox-tree] net/mlx5: prevent an integer underflow in mlx5_perout_configure()

2021-02-19 Thread Dan Carpenter
on mode support") Signed-off-by: Dan Carpenter --- Saeed, I think this goes through your git tree and you will send a pull request to the networking? >From static analysis. Not tested. drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-

[PATCH net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()

2021-02-19 Thread Dan Carpenter
This code does not allocate enough memory for the NUL terminator so it ends up putting it one character beyond the end of the buffer. Fixes: 8756828a8148 ("octeontx2-af: Add NPA aura and pool contexts to debugfs") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/marvell/oc

Re: [PATCH net-next] net: phy: icplus: Call phy_restore_page() when phy_select_page() fails

2021-02-17 Thread Dan Carpenter
t;phydev" variables can possibly be in &selected state and print a warning. The code is below. regards, dan carpenter #include "smatch.h" #include "smatch_slist.h" static int my_id; STATE(selected); static sval_t err_min = { .type = &int_ctype, .value = -4095 }

Re: [PATCH net-next] net: phy: icplus: Call phy_restore_page() when phy_select_page() fails

2021-02-17 Thread Dan Carpenter
On Wed, Feb 17, 2021 at 09:17:59AM +0300, Dan Carpenter wrote: > Smatch warns that there is a locking issue in this function: > > drivers/net/phy/icplus.c:273 ip101a_g_config_intr_pin() > warn: inconsistent returns '&phydev->mdio.bus->mdio_lock'. > Locked on

[PATCH net-next] octeontx2-pf: Fix otx2_get_fecparam()

2021-02-16 Thread Dan Carpenter
rt the incorrect fix. Fixes: 93efb0c65683 ("octeontx2-pf: Fix out-of-bounds read in otx2_get_fecparam()") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/

[PATCH net-next] net: phy: icplus: Call phy_restore_page() when phy_select_page() fails

2021-02-16 Thread Dan Carpenter
say we have to call phy_restore_page() even if the call to phy_select_page() fails. Fixes: f9bc51e6cce2 ("net: phy: icplus: fix paged register access") Signed-off-by: Dan Carpenter --- drivers/net/phy/icplus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/

[PATCH net-next] cteontx2-pf: cn10k: Prevent harmless double shift bugs

2021-02-16 Thread Dan Carpenter
quot;octeontx2-pf: cn10k: Add mbox support for CN10K") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethe

[bug report] net: fix dev_ifsioc_locked() race condition

2021-02-16 Thread Dan Carpenter
copy_to_user(&ifr->ifr_hwaddr, &sa, sizeof(sa))) 1096 ret = -EFAULT; 1097 tap_put_tap_dev(tap); 1098 rtnl_unlock(); 1099 return ret; 1100 regards, dan carpenter

Re: [PATCH v3] staging: fix coding style in driver/staging/qlge/qlge_main.c

2021-02-16 Thread Dan Carpenter
g" then you end up wasting maintainer time and developer time. That's like an ambiguous thing, right? We try to avoid ambiguity and be mechanical and predictable. We won't apply patches which fix checkpatch warnings if the result is worse looking code. This might seem like an ambiguous judgement call to newbies but it is actually 100% predictable to oldbies. :P Anyway the v2 v3 stuff is supposed to be below the --- cut off so please fix that and resend. regards, dan carpenter

Re: [net-next] tcp: Sanitize CMSG flags and reserved args in tcp_zerocopy_receive.

2021-02-15 Thread Dan Carpenter
On Mon, Feb 15, 2021 at 08:04:11AM -0700, David Ahern wrote: > On 2/15/21 5:03 AM, Dan Carpenter wrote: > > Hi Arjun, > > > > url: > > https://github.com/0day-ci/linux/commits/Arjun-Roy/tcp-Sanitize-CMSG-flags-and-reserved-args-in-tcp_zerocopy_receive/20210212-052

[PATCH net-next] octeontx2-pf: fix an off by one bug in otx2_get_fecparam()

2021-02-15 Thread Dan Carpenter
by itself. And I removed the FEC_MAX_INDEX define and used ARRAY_SIZE(fec) instead. Fixes: d0cf9503e908 ("octeontx2-pf: ethtool fec mode support") Signed-off-by: Dan Carpenter --- .../net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c| 9 + 1 file changed, 5 insertions(+),

Re: [PATCH net-next 09/12] net: dsa: tag_ocelot: create separate tagger for Seville

2021-02-15 Thread Dan Carpenter
On Mon, Feb 15, 2021 at 03:19:31PM +0200, Vladimir Oltean wrote: > Hi Dan, > > On Mon, Feb 15, 2021 at 04:00:04PM +0300, Dan Carpenter wrote: > > db->index is less than db->num_ports which 32 or less but sometimes it > > comes from the device tree so who knows. >

Re: [PATCH net-next 09/12] net: dsa: tag_ocelot: create separate tagger for Seville

2021-02-15 Thread Dan Carpenter
.config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: net/dsa/tag_ocelot.c:59 ocelot_xmit() warn: should '(((1))) << (dp->index)' be a 64 bit type? n

Re: [net-next] tcp: Sanitize CMSG flags and reserved args in tcp_zerocopy_receive.

2021-02-15 Thread Dan Carpenter
-m001-20210209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: net/ipv4/tcp.c:4158 do_tcp_getsockopt() warn: check for integer overflow 'len&

Re: [PATCH 1/2 net-next] net/mlx5e: TC: Fix IS_ERR() vs NULL checks

2021-02-15 Thread Dan Carpenter
On Mon, Sep 28, 2020 at 06:31:04PM +, Ariel Levkovich wrote: > On Sep 28, 2020, at 13:42, Dan Carpenter wrote: > > > > The mlx5_tc_ct_init() function doesn't return error pointers it returns > > NULL. Also we need to set the error codes on this path. > >

Re: [bug report] net/mlx5e: E-Switch, Maintain vhca_id to vport_num mapping

2021-02-10 Thread Dan Carpenter
On Wed, Feb 10, 2021 at 01:48:20PM +0200, Leon Romanovsky wrote: > On Wed, Feb 10, 2021 at 11:51:51AM +0300, Dan Carpenter wrote: > > Hello Vlad Buslov, > > > > The patch 84ae9c1f29c0: "net/mlx5e: E-Switch, Maintain vhca_id to > > vport_num mapping" from Sep 23

[PATCH net-next] net/mlx5: Fix a NULL vs IS_ERR() check

2021-02-10 Thread Dan Carpenter
The mlx5_chains_get_table() function doesn't return NULL, it returns error pointers so we need to fix this condition. Fixes: 34ca65352ddf ("net/mlx5: E-Switch, Indirect table infrastructure") Signed-off-by: Dan Carpenter --- This applies to net-next but it might actually go thro

[kbuild] Re: [PATCH v2 net-next 2/3] qede: add per queue coalesce support for qede driver

2021-02-10 Thread Dan Carpenter
-20210209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter New smatch warnings: drivers/net/ethernet/qlogic/qede/qede_ethtool.c:2188 qede_get_per_coalesce() warn

[PATCH v3 2/2 net-next] net: mscc: ocelot: fix error code in mscc_ocelot_probe()

2021-02-02 Thread Dan Carpenter
Probe should return an error code if platform_get_irq_byname() fails but it returns success instead. Fixes: 6c30384eb1de ("net: mscc: ocelot: register devlink ports") Signed-off-by: Dan Carpenter Reviewed-by: Vladimir Oltean --- v3: rebase drivers/net/ethernet/mscc/ocelot_vsc

[PATCH net-next] net: mscc: ocelot: fix error handling bugs in mscc_ocelot_init_ports()

2021-02-02 Thread Dan Carpenter
g to resource leaks and double frees. Fixes: 6c30384eb1de ("net: mscc: ocelot: register devlink ports") Signed-off-by: Dan Carpenter Reviewed-by: Vladimir Oltean Tested-by: Vladimir Oltean --- v2: Part of the commit was missing v3: The first version introduced a bug which completel

Re: KASAN: slab-out-of-bounds Read in add_adv_patterns_monitor

2021-02-02 Thread Dan Carpenter
ed process because the cmd cannot complete. Sometimes it's hard to know what the affect of a bug is, but since you're working in the subsystem then you probably have a better guess than the rest of us so even a guess is useful. regards, dan carpenter

Re: KASAN: slab-out-of-bounds Read in add_adv_patterns_monitor

2021-02-01 Thread Dan Carpenter
u > > BT_DBG("request for %s", hdev->name); > > - if (len <= sizeof(*cp) || cp->pattern_count == 0) { > + if (len <= sizeof(*cp) || cp->pattern_count == 0 || > + len < sizeof(*cp) + cp->pattern_count * > + sizeof(struct mgmt_adv_pattern)) { > err = mgmt_cmd_status(sk, hdev->id, > MGMT_OP_ADD_ADV_PATTERNS_MONITOR, > MGMT_STATUS_INVALID_PARAMS); > I think this was already fixed on Jan 22 commit b4a221ea8a1f ("Bluetooth: advmon offload MSFT add rssi support"). expected_size += cp->pattern_count * sizeof(struct mgmt_adv_pattern); if (len != expected_size) { Now someone needs to backport it to stable. regards, dan carpenter

[PATCH net] net: ipa: pass correct dma_handle to dma_free_coherent()

2021-02-01 Thread Dan Carpenter
The "ring->addr = addr;" assignment is done a few lines later so we can't use "ring->addr" yet. The correct dma_handle is "addr". Fixes: 650d1603825d ("soc: qcom: ipa: the generic software interface") Signed-off-by: Dan Carpenter --- Smatch al

[PATCH v2 1/2 net-next] net: mscc: ocelot: fix error handling bugs in mscc_ocelot_init_ports()

2021-01-26 Thread Dan Carpenter
quot; pre-op instead of a post-op to avoid a buffer underflow. The "if (!registered_ports[port])" condition was reversed leading to resource leaks and double frees. Fixes: 6c30384eb1de ("net: mscc: ocelot: register devlink ports") Signed-off-by: Dan Carpenter --- v2: In v1

[PATCH 1/2 net-next] net: mscc: ocelot: fix error handling bugs in mscc_ocelot_init_ports()

2021-01-26 Thread Dan Carpenter
quot; pre-op instead of a post-op to avoid a buffer underflow. The "if (!registered_ports[port])" condition was reversed leading to resource leaks and double frees. Fixes: 6c30384eb1de ("net: mscc: ocelot: register devlink ports") Signed-off-by: Dan Carpenter --- drivers/n

Re: [PATCH nf-next v4 1/5] net: sched: Micro-optimize egress handling

2021-01-26 Thread Dan Carpenter
mention our static checkers.. > > > Dan, do you think the concern from the above-quoted commit is still > valid? Is this something that smatch flags these days? We're apparently > paying a real performance price in networking for tying compiler's hands > with -fno-delete-null-pointer-checks If I had to guess why GCC doesn't warn about this I would say that probably it's because a lot of macros have NULL checks built in. Most static analysis tools have a warning about inconsistent NULL checks but Smatch won't warn about it unless it can lead to a NULL dereference. The fact that pointless NULL checks slow down the code has never bothered anyone up to now. regards, dan carpenter

Re: [PATCH v2 1/2 net-next] net: mscc: ocelot: fix error handling bugs in mscc_ocelot_init_ports()

2021-01-26 Thread Dan Carpenter
On Mon, Jan 25, 2021 at 04:18:07PM +, Vladimir Oltean wrote: > Hi Dan, > > On Mon, Jan 25, 2021 at 11:42:03AM +0300, Dan Carpenter wrote: > > diff --git a/drivers/net/ethernet/mscc/ocelot_net.c > > b/drivers/net/ethernet/mscc/ocelot_net.c > > index 9553eb3e441c..87

[PATCH v2 2/2 net-next] net: mscc: ocelot: fix error code in mscc_ocelot_probe()

2021-01-25 Thread Dan Carpenter
Probe should return an error code if platform_get_irq_byname() fails but it returns success instead. Fixes: 6c30384eb1de ("net: mscc: ocelot: register devlink ports") Signed-off-by: Dan Carpenter --- v2: no change drivers/net/ethernet/mscc/ocelot_vsc7514.c | 4 +++- 1 file

Re: [PATCH 1/2 net-next] net: mscc: ocelot: fix error handling bugs in mscc_ocelot_init_ports()

2021-01-25 Thread Dan Carpenter
Oops. Please ignore this patch. Part of it is missing. regards, dan carpenter

[PATCH 2/2 net-next] net: mscc: ocelot: fix error code in mscc_ocelot_probe()

2021-01-25 Thread Dan Carpenter
Probe should return an error code if platform_get_irq_byname() fails but it returns success instead. Fixes: 6c30384eb1de ("net: mscc: ocelot: register devlink ports") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 4 +++- 1 file changed, 3 insert

Re: [PATCH v3 1/3] can: dev: can_restart: fix use after free bug

2021-01-20 Thread Dan Carpenter
the git log. > drivers/net/can/dev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > regards, dan carpenter

[PATCH net] net: dsa: b53: fix an off by one in checking "vlan->vid"

2021-01-19 Thread Dan Carpenter
482d2ce349 ("net: dsa: b53: Plug in VLAN support") Signed-off-by: Dan Carpenter --- drivers/net/dsa/b53/b53_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 288b5a5c3e0d..95c7fa171e35

[PATCH net-next] net: dsa: Fix off by one in dsa_loop_port_vlan_add()

2021-01-19 Thread Dan Carpenter
52ea27 ("net: dsa: Mock-up driver") Signed-off-by: Dan Carpenter --- I'm not 100% sure where this is checked but the other code has comments and assumptions that say that it is and Smatch says that it is. If I had to guess, I would say that the check is in the nla policy. [NL

Re: [PATCH v5 net-next 11/16] net: propagate errors from dev_get_stats

2021-01-11 Thread Dan Carpenter
58334e7537278793c86baa88b70c48b0d50b00ae config: i386-randconfig-m021-20210108 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter New smatch warnings: net/core

Re: [v2] net: qrtr: fix null pointer dereference in qrtr_ns_remove

2021-01-06 Thread Dan Carpenter
s is an official proposal. > Feel free to ignore Markus... :/ We have asked him over and over to stop sending these sort of advice but he refused and eventually he was banned from the mailing lists. The rest of us can't see his messages to you unless we're included personally in the CC list. regards, dan carpenter

[kbuild] Re: [PATCH netdev 5/5] virtio-net, xsk: virtio-net support xsk zero copy tx

2021-01-05 Thread Dan Carpenter
9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter New smatch warnings: drivers/net/virtio_net.c:2669 virtnet_xsk_timeout() warn: test_bit() takes a bit number drivers/net/virtio_net.c:2899 virtnet_xsk_run() warn

Re: [PATCH v3 09/24] wfx: add hwio.c/hwio.h

2021-01-04 Thread Dan Carpenter
Of course, Smatch didn't trigger any warnings in the wfx driver. I need to try re-write this check to use the cross function database so function pointers are handled. regards, dan carpenter

Re: [PATCH v3 09/24] wfx: add hwio.c/hwio.h

2021-01-04 Thread Dan Carpenter
stack with DMA. > > > > You should never do that because some platforms do not support it, so no > > driver should ever try to do that as they do not know what platform they > > are running on. > > Yes, I have learned this rule the hard way. > > There is no better

[PATCH net] atm: idt77252: call pci_disable_device() on error path

2020-12-19 Thread Dan Carpenter
This error path needs to disable the pci device before returning. Fixes: ede58ef28e10 ("atm: remove deprecated use of pci api") Signed-off-by: Dan Carpenter --- drivers/atm/idt77252.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/atm/idt77252.c b/d

[PATCH net] qlcnic: Fix error code in probe

2020-12-16 Thread Dan Carpenter
Return -EINVAL if we can't find the correct device. Currently it returns success. Fixes: 13159183ec7a ("qlcnic: 83xx base driver") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/

Re: [PATCH] net: allwinner: Fix some resources leak in the error handling path of the probe and in the remove function

2020-12-15 Thread Dan Carpenter
On Tue, Dec 15, 2020 at 08:08:15PM +0100, Maxime Ripard wrote: > On Tue, Dec 15, 2020 at 07:18:48PM +0100, Christophe JAILLET wrote: > > Le 15/12/2020 à 12:37, Maxime Ripard a écrit : > > > On Tue, Dec 15, 2020 at 12:11:53PM +0300, Dan Carpenter wrote: > > > > On T

Re: [PATCH] net: allwinner: Fix some resources leak in the error handling path of the probe and in the remove function

2020-12-15 Thread Dan Carpenter
here is some resources leaks. > > Do you have a source to back that? It's not clear at all from the > documentation for those functions, and couldn't find any user calling it > from the ten-or-so random picks I took. It looks like irq_create_of_mapping() needs to be fre

Re: [PATCH] net: mscc: ocelot: Fix a resource leak in the error handling path of the probe function

2020-12-14 Thread Dan Carpenter
_switchdev_blocking_nb); 1284 1285 dev_info(&pdev->dev, "Ocelot switch probed\n"); 1286 1287 out_put_ports: 1288 of_node_put(ports); 1289 return err; 1290 } regards, dan carpenter

Re: [PATCH net-next 3/4] sch_htb: Stats for offloaded HTB

2020-12-11 Thread Dan Carpenter
On Thu, Dec 10, 2020 at 05:07:28PM +0200, Maxim Mikityanskiy wrote: > On 2020-12-10 10:28, Dan Carpenter wrote: > > Hi Maxim, > > > > > > url: > > https://github.com/0day-ci/linux/commits/Maxim-Mikityanskiy/HTB-offload/20201210-000703 > > base: > >

Re: [PATCH net-next 3/4] sch_htb: Stats for offloaded HTB

2020-12-10 Thread Dan Carpenter
: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: net/sched/sch_htb.c:1310 htb_dump_class_stats() error: we previously assumed 'cl->leaf.q' could be null (see line 130

Re: [PATCH 01/11] drivers: staging: speakup: remove unneeded MODULE_VERSION() call

2020-12-03 Thread Dan Carpenter
> Signed-off-by: Enrico Weigelt > > --- > > drivers/accessibility/speakup/main.c | 1 - > > > > Yous subject line is odd, these are not "staging" drivers anymore, so > why do you say they are there? Also putting "drivers:" in the subject always seems superfluous. regards, dan carpenter

[PATCH net] chelsio/chtls: fix a double free in chtls_setkey()

2020-12-03 Thread Dan Carpenter
t makes the kfree_skb() a no-op. Fixes: d25f2f71f653 ("crypto: chtls - Program the TLS session Key") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/chelsio/inline_cry

[PATCH net-next] octeontx2-af: debugfs: delete dead code

2020-12-01 Thread Dan Carpenter
These debugfs never return NULL so all this code will never be run. In the normal case, (and in this case particularly), the debugfs functions are not supposed to be checked for errors so all this error checking code can be safely deleted. Signed-off-by: Dan Carpenter --- .../marvell/octeontx2

[PATCH net v2] net/x25: prevent a couple of overflows

2020-12-01 Thread Dan Carpenter
ted-by: "kiyin(尹亮)" Signed-off-by: Dan Carpenter --- The first patch put a NUL terminator on the end of the string and this patch returns an error instead. I don't have a strong preference, which patch to go with. net/x25/af_x25.c | 6 -- 1 file changed, 4 insertions(+), 2

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-12-01 Thread Dan Carpenter
h (x) { > case 0: > ++x; > default: > ; > } Don't warn for this. If adding a break statement changes the flow of the code then warn about potentially missing break statements, but if it doesn't change anything then don't warn about it. regards, dan carpenter

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-12-01 Thread Dan Carpenter
of a warning. > > FWIW, this series has found at least one bug so far: > https://lore.kernel.org/lkml/CAFCwf11izHF=g1mGry1fE5kvFFFrxzhPSM6qKAO8gxSp=kr...@mail.gmail.com/ This is a fallthrough to a return and not to a break. That should trigger a warning. The fallthrough to a break should not generate a warning. The bug we're trying to fix is "missing break statement" but if the result of the bug is "we hit a break statement" then now we're just talking about style. GCC should limit itself to warning about potentially buggy code. regards, dan carpenter

Re: [PATCH 127/141] staging: qlge: Fix fall-through warnings for Clang

2020-11-30 Thread Dan Carpenter
ate to remove the > "default" case. There are checkers which complain about that. (As a static checker developer myself, I think complaining about missing default cases is a waste of everyone's time). regards, dan carpenter

Re: [PATCH 109/141] net: netrom: Fix fall-through warnings for Clang

2020-11-30 Thread Dan Carpenter
t->routes[1] = > t->routes[2]; > + break; > case 2: > break; > } regards, dan carpenter

[PATCH net] net/x25: prevent a couple of overflows

2020-11-30 Thread Dan Carpenter
o putting a NUL terminator as the 16th character is safe and obviously preferable to reading out of bounds. Signed-off-by: "kiyin(尹亮)" Signed-off-by: Dan Carpenter --- net/x25/af_x25.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 0bb

[PATCH net-next] mlxsw: spectrum_router: Fix a double free on error

2020-11-18 Thread Dan Carpenter
There is a double free here because mlxsw_sp_nexthop6_group_create() and mlxsw_sp_nexthop6_group_info_init() free "nh_grp". It should only be freed in the create function. Fixes: 7f7a417e6a11 ("mlxsw: spectrum_router: Split nexthop group configuration to a different struct"

Re: [MPTCP][PATCH net 1/2] mptcp: fix static checker warnings in mptcp_pm_add_timer

2020-11-09 Thread Dan Carpenter
; > > Too late. > > > > 214 return; > > 215 > > > > Fixes: 93f323b9 ("mptcp: add a new sysctl add_addr_timeout") > > Reported-by: Dan Carpenter > > Signed-off-by: Geliang Tang >

Re: [RFC] wimax: move out to staging

2020-10-28 Thread Dan Carpenter
all the software on it and an ethernet cable into your house. I don't know what software the antennaes are using. Probably Linux but with an out of tree kernel module is my guess. regards, dan carpenter

Re: [PATCH bpf-next V4 2/5] bpf: bpf_fib_lookup return MTU value as output when looked up

2020-10-28 Thread Dan Carpenter
9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter New smatch warnings: net/core/filter.c:5395 bpf_ipv4_fib_lookup() error: uninitialized symbol 'mtu'. vim +/mtu +5395 net/core/filter.c 87f5fc7e48d

Re: [PATCH] tcp: fix race condition when creating child sockets from syncookies

2020-10-26 Thread Dan Carpenter
-randconfig-m021-20201022 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: net/ipv4/inet_hashtables.c:570 inet_ehash_insert_chk_dup() error: uninitialized

[PATCH 2/2 net] devlink: Unlock on error in dumpit()

2020-10-26 Thread Dan Carpenter
This needs to unlock before returning. Fixes: 544e7c33ec2f ("net: devlink: Add support for port regions") Signed-off-by: Dan Carpenter --- net/core/devlink.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index 03

[PATCH 1/2 net] devlink: Fix some error codes

2020-10-26 Thread Dan Carpenter
These paths don't set the error codes. It's especially important in devlink_nl_region_notify_build() where it leads to a NULL dereference in the caller. Fixes: 544e7c33ec2f ("net: devlink: Add support for port regions") Signed-off-by: Dan Carpenter --- net

Re: [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup()

2020-10-25 Thread Dan Carpenter
On Mon, Oct 26, 2020 at 11:18:16AM +0800, Yunsheng Lin wrote: > On 2020/10/23 19:22, Dan Carpenter wrote: > > Smatch complains that "ret" might be uninitialized if we don't enter > > the loop. We do always enter the loop so it's a false positive, but > > i

[PATCH net] vhost_vdpa: Return -EFUALT if copy_from_user() fails

2020-10-23 Thread Dan Carpenter
The copy_to/from_user() functions return the number of bytes which we weren't able to copy but the ioctl should return -EFAULT if they fail. Fixes: a127c5bbb6a8 ("vhost-vdpa: fix backend feature ioctls") Signed-off-by: Dan Carpenter --- drivers/vhost/vdpa.c | 10 +- 1

[PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup()

2020-10-23 Thread Dan Carpenter
Smatch complains that "ret" might be uninitialized if we don't enter the loop. We do always enter the loop so it's a false positive, but it's cleaner to just return a literal zero and that silences the warning as well. Signed-off-by: Dan Carpenter --- drivers/net/ether

Re: [PATCH net] mISDN: hfcpci: Fix a use after free in hfcmulti_tx()

2020-10-22 Thread Dan Carpenter
old one, > which would be the result of this patch. > Oh, wow. You're absolutely right. That's pretty subtle. Thanks for catching it. regards, dan carpenter > Best regards > Karsten > > On 10/22/20 9:07 AM, Dan Carpenter wrote: > > This frees "*s

[PATCH net] mISDN: hfcpci: Fix a use after free in hfcmulti_tx()

2020-10-22 Thread Dan Carpenter
This frees "*sp" before dereferencing it to get "len = (*sp)->len;". Fixes: af69fb3a8ffa ("Add mISDN HFC multiport driver") Signed-off-by: Dan Carpenter --- drivers/isdn/hardware/mISDN/hfcmulti.c | 10 -- 1 file changed, 4 insertions(+), 6 deleti

Re: [PATCH v2 2/7] staging: qlge: Initialize devlink health dump framework

2020-10-14 Thread Dan Carpenter
in the function but when there are three or more allocations, then use gotos to unwind. Ideally there would be a ql_deinit_device() function to mirror the ql_init_device() function. The ql_init_device() is staging quality code with leaks and bad label names. It should be re-written to free things one step at a time instead of calling ql_release_all(). Anyway, let's not introduce new leaks at least. regards, dan carpenter

Re: [PATCH 2/8] staging: wfx: check memory allocation

2020-10-10 Thread Dan Carpenter
> dereference 'tmp_buf' > > >227 tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); > > >228 ret = wfx_send_pds(wdev, tmp_buf, pds->size); > > > ^^^ > > >229 kfree(tmp_

Re: [PATCH 2/8] staging: wfx: check memory allocation

2020-10-10 Thread Dan Carpenter
On Sat, Oct 10, 2020 at 04:18:11PM +0300, Dan Carpenter wrote: > On Sat, Oct 10, 2020 at 02:07:13PM +0200, Jérôme Pouiller wrote: > > On Friday 9 October 2020 20:51:01 CEST Kalle Valo wrote: > > > CAUTION: This email originated from outside of the organization. Do not > &g

Re: [PATCH] stating: octeon: Drop on uncorrectable alignment or FCS error

2020-10-09 Thread Dan Carpenter
r_code == 5 || > + return 0; > + > + if (work->word2.snoip.err_code == 5 || > work->word2.snoip.err_code == 7) { This line is indented to match the old code and it no longer matches. (Please update the whitespace). > /* >* We received a packet with either an alignment error regards, dan carpenter

Re: [PATCH v1 2/6] staging: qlge: coredump via devlink health reporter

2020-10-08 Thread Dan Carpenter
tly in the code. Don't introduce indirection if you can help it. > + int regs_num = (seg_header->seg_size - header_size) / sizeof(u32); > + int err; > + regards, dan carpenter

Re: [PATCH v1 1/6] staging: qlge: Initialize devlink health dump framework for the dlge driver

2020-10-08 Thread Dan Carpenter
; + struct devlink *devlink; > + struct qlge_devlink *ql_devlink; > + > + devlink = devlink_alloc(&qlge_devlink_ops, sizeof(struct qlge_devlink)); > + if (!devlink) > + return -ENOMEM; > + ql_devlink = devlink_priv(devlink); > > ndev = alloc_etherdev_mq(sizeof(struct ql_adapter), >min(MAX_CPUS, > @@ -4614,6 +4624,16 @@ static int qlge_probe(struct pci_dev *pdev, > free_netdev(ndev); > return err; > } > + > + err = devlink_register(devlink, &pdev->dev); > + if (err) { > + goto devlink_free; > + } Checkpatch warning. regards, dan carpenter

Re: [PATCH 0/7] wfx: move out from the staging area

2020-10-08 Thread Dan Carpenter
t ieee80211_supported_band)->bitrates' overflow 'band->bitrates' 0 <= abs_rl '0-127' user_rl '' required = '(struct ieee80211_supported_band)->n_bitrates' Some of these are unpublished checks that I haven't published because they are too

Re: [PATCH][next] net: phy: dp83869: fix unsigned comparisons against less than zero values

2020-10-06 Thread Dan Carpenter
re as the previous comparison issue > reported by zero day. It was reported on Sep 25. I forward those zero day bot emails. https://lore.kernel.org/lkml/20200925123858.GX18329@kadam/ regards, dan carpenter

Re: [PATCH 1/2 net-next] net/mlx5e: TC: Fix IS_ERR() vs NULL checks

2020-09-28 Thread Dan Carpenter
On Mon, Sep 28, 2020 at 06:31:04PM +, Ariel Levkovich wrote: > On Sep 28, 2020, at 13:42, Dan Carpenter wrote: > > > > The mlx5_tc_ct_init() function doesn't return error pointers it returns > > NULL. Also we need to set the error codes on this path. > >

[PATCH 2/2 net-next] net/mlx5e: TC: Fix potential Oops in mlx5e_tc_unoffload_from_slow_path()

2020-09-28 Thread Dan Carpenter
If "slow_attr" is NULL then this function will Oops. Fixes: c620b772152b ("net/mlx5: Refactor tc flow attributes structure") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff

[PATCH 1/2 net-next] net/mlx5e: TC: Fix IS_ERR() vs NULL checks

2020-09-28 Thread Dan Carpenter
The mlx5_tc_ct_init() function doesn't return error pointers it returns NULL. Also we need to set the error codes on this path. Fixes: aedd133d17bc ("net/mlx5e: Support CT offload for tc nic flows") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/mellanox/mlx5/c

[PATCH net-next] net/mlx5e: Fix a use after free on error in mlx5_tc_ct_shared_counter_get()

2020-09-28 Thread Dan Carpenter
This code frees "shared_counter" and then dereferences on the next line to get the error code. Fixes: 1edae2335adf ("net/mlx5e: CT: Use the same counter for both directions") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 4 +++

  1   2   3   4   5   6   >