Re: [PATCH][next] net: hinic: fix comparison of a uint16_t type with -1

2017-08-24 Thread Dan Carpenter
54 355 if (hw_ioctxt.rx_buf_sz_idx == -1) 356 return -EINVAL; 357 The loop doesn't make sense. We are looping through rx_buf_sz_table[] until we hit 2048 or -1. But 2048 comes first so we always get there and break. We may as well replace all that code with: hw_ioctxt.rx_buf_sz_idx = 11; Something is very wrong. regards, dan carpenter

Re: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs()

2017-08-21 Thread Dan Carpenter
On Mon, Aug 21, 2017 at 02:52:34PM +, David Laight wrote: > From: Dan Carpenter > > Sent: 21 August 2017 10:48 > > The get_options() function takes the whole ARRAY_SIZE(). It doesn't > > matter here because we don't use more than 7 elements. > > > > Signed-

[PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs()

2017-08-21 Thread Dan Carpenter
The get_options() function takes the whole ARRAY_SIZE(). It doesn't matter here because we don't use more than 7 elements. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c index f71883

[PATCH net-next] bpf: fix a return in sockmap_get_from_fd()

2017-08-18 Thread Dan Carpenter
"map" is a valid pointer. We wanted to return "err" instead. Also let's return a zero literal at the end. Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/kernel/bpf/sy

Thoughts on staging and on fixing up drivers?

2017-08-17 Thread Dan Carpenter
I'm excited to see all the @realtek.com addresses. :) Larry, you've migrated a bunch of staging code, and tried various approaches. Do you have any lessons on what has worked and what hasn't and if there is anything we can do to make the process better? regards, dan carpenter

[bug report] net: dsa: ksz: fix skb freeing

2017-08-16 Thread Dan Carpenter
ree_skb(skb); 69 } 70 71 tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN); 72 tag[0] = 0; 73 tag[1] = 1 << p->dp->index; /* destination port */ 74 75 return nskb; 76 } regards, dan carpenter

[PATCH 2/2 net-next] hns3pf: Fix some harmless copy and paste bugs

2017-08-10 Thread Dan Carpenter
These were copy and paste bugs, but I believe they are harmless. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c index e519795dff7c..9589b7e1d24c

[PATCH 1/2 net-next] hns3pf: fix hns3_del_tunnel_port()

2017-08-10 Thread Dan Carpenter
This function has a copy and paste bug so it accidentally calls the add function instead of the delete function. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/driv

[PATCH net-next] phylink: Fix an uninitialized variable bug

2017-08-09 Thread Dan Carpenter
"ret" isn't necessarily initialized here. Fixes: 9525ae83959b ("phylink: add phylink infrastructure") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 32917bdd1432..bcb4755bcd95 100644 --- a

[PATCH] net: phy: marvell: logical vs bitwise OR typo

2017-08-04 Thread Dan Carpenter
This was supposed to be a bitwise OR but there is a || vs | typo. Fixes: 864dc729d528 ("net: phy: marvell: Refactor m88e1121 RGMII delay configuration") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c in

Re: [PATCH net] mcs7780: Silence uninitialized variable warning

2017-08-01 Thread Dan Carpenter
On Mon, Jul 31, 2017 at 10:37:16AM -0700, David Miller wrote: > From: Dan Carpenter <dan.carpen...@oracle.com> > Date: Mon, 31 Jul 2017 10:41:40 +0300 > > > On Sat, Jul 29, 2017 at 11:28:55PM -0700, David Miller wrote: > >> From: Dan Carpenter <dan.carpen...@o

Re: [PATCH net] mcs7780: Silence uninitialized variable warning

2017-07-31 Thread Dan Carpenter
On Sat, Jul 29, 2017 at 11:28:55PM -0700, David Miller wrote: > From: Dan Carpenter <dan.carpen...@oracle.com> > Date: Fri, 28 Jul 2017 17:45:11 +0300 > > > - __u16 rval; > > + __u16 rval = -1; > > Fixing a bogus warning by assigning a signed constant to an &

[PATCH net] mcs7780: Silence uninitialized variable warning

2017-07-28 Thread Dan Carpenter
My static checker complains that, if the allocation in mcs_get_reg() fails, it means we use "rval" without initializing it. Small allocations never fail in current kernels so it's not a major concern but it's simple enough to silence the warning. Signed-off-by: Dan Carpenter &

[PATCH net-next] bpf: dev_map_alloc() shouldn't return NULL

2017-07-22 Thread Dan Carpenter
We forgot to set the error code on two error paths which means that we return ERR_PTR(0) which is NULL. The caller, find_and_alloc_map(), is not expecting that and will have a NULL dereference. Fixes: 546ac1ffb70d ("bpf: add devmap, a map for storing net device references") Signed-o

[PATCH] libceph: potential NULL dereference in ceph_msg_data_create()

2017-07-17 Thread Dan Carpenter
If kmem_cache_zalloc() returns NULL then the INIT_LIST_HEAD(>links); will Oops. The callers aren't really prepared for NULL returns so it doesn't make a lot of difference in real life. Fixes: 5240d9f95dfe ("libceph: replace message data pointer with list") Signed-off-by:

Re: [PATCH net] libceph: osdmap: Fix some NULL dereferences

2017-07-13 Thread Dan Carpenter
but I somehow marked it as done yesterday without sending a patch. Thanks for catching that. The Smatch check is just looking for places where we do ERR_PTR(0) or ERR_PTR(valid_ptr). That can be intentional, so there is some hand reviewing involved. regards, dan carpenter

[PATCH net] libceph: osdmap: Fix some NULL dereferences

2017-07-13 Thread Dan Carpenter
There are hidden gotos in the ceph_decode_* macros. We need to set the "err" variable on these error paths otherwise we end up returning ERR_PTR(0) which is NULL. It causes NULL dereferences in the callers. Fixes: 278b1d709c6a ("libceph: ceph_decode_skip_* helpers") Signed-o

[PATCH net] net: ipmr: ipmr_get_table() returns NULL

2017-07-12 Thread Dan Carpenter
The ipmr_get_table() function doesn't return error pointers it returns NULL on error. Fixes: 4f75ba6982bc ("net: ipmr: Add ipmr_rtm_getroute") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index bb909f1d7537..06863ea3fc5b

[PATCH net] nfp: freeing the wrong variable

2017-07-12 Thread Dan Carpenter
We accidentally free a NULL pointer and leak the pointer we want to free. Also you can tell from the label name what was intended. :) Fixes: abfcdc1de9bf ("nfp: add a stats handler for flower offloads") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/driv

Re: [PATCH 1/2 net] ptp: fix error codes in ptp_clock_register()

2017-07-10 Thread Dan Carpenter
On Mon, Jul 10, 2017 at 11:48:06AM +0200, Richard Cochran wrote: > On Mon, Jul 10, 2017 at 12:38:16PM +0300, Dan Carpenter wrote: > > There were two buggy commits so I chose the ealier one. The other buggy > > No, you are mistaken. In the original patch, NULL or PTR_ERR were >

Re: [PATCH 1/2 net] ptp: fix error codes in ptp_clock_register()

2017-07-10 Thread Dan Carpenter
On Mon, Jul 10, 2017 at 11:21:03AM +0200, Richard Cochran wrote: > On Mon, Jul 10, 2017 at 10:11:37AM +0300, Dan Carpenter wrote: > > The ptp_clock_register() function returns NULL when it's #ifdefed out > > because CONFIG_PTP_1588_CLOCK is disabled. Otherwise, it's intended to &

[PATCH 2/2 net] cxgb4: ptp_clock_register() returns error pointers

2017-07-10 Thread Dan Carpenter
We're checking ptp_clock_register() for NULL but we should be checking for error pointers. Fixes: 9c33e4208bce ("cxgb4: Add PTP Hardware Clock (PHC) support") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.

[PATCH 1/2 net] ptp: fix error codes in ptp_clock_register()

2017-07-10 Thread Dan Carpenter
dereferences in the callers. Fixes: d94ba80ebbea ("ptp: Added a brand new class driver for ptp clocks.") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index b77435783ef3..a50e96143a25 100644 --- a/drivers/ptp/p

Re: [RFC] tls: length check correct in do_tls_getsockopt_tx()?

2017-07-05 Thread Dan Carpenter
ng? No, you're right. It should be "sizeof(*crypto_info)". It's hard for Smatch to catch these sorts of bugs because Sparse sometimes just gives Smatch a number literal instead of a sizeof() expression. I think Coccinelle can catch these kinds of bugs? regards, dan carpenter

[PATCH net] rocker: move dereference before free

2017-06-28 Thread Dan Carpenter
My static checker complains that ofdpa_neigh_del() can sometimes free "found". It just makes sense to use it first before deleting it. Fixes: ecf244f753e0 ("rocker: fix maybe-uninitialized warning") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- Most

[PATCH net-next] net: dsa: mv88e6xxx: fix error code in mv88e6390_serdes_power()

2017-06-23 Thread Dan Carpenter
We're accidentally returning the wrong variable. "cmode" is uninitialized at this point so it causes a static checker warning. Fixes: 6335e9f2446b ("net: dsa: mv88e6xxx: mv88e6390X SERDES support") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a

Re: [PATCH -net] tls: return -EFAULT if copy_to_user() fails

2017-06-23 Thread Dan Carpenter
of the value returned In the original code, it's not returning the "actual size of the value returned". It's returning a smaller or equal value... The man page is correct that this is how some getsockopts work, of course. But here -EFAULT is expected. regards, dan carpenter

Re: [PATCH -net] tls: return -EFAULT if copy_to_user() fails

2017-06-23 Thread Dan Carpenter
On Fri, Jun 23, 2017 at 03:31:44AM -0700, Joe Perches wrote: > On Fri, 2017-06-23 at 13:15 +0300, Dan Carpenter wrote: > > The copy_to_user() function returns the number of bytes remaining but we > > want to return -EFAULT here. > > because? > Rhetorical questio

Re: [PATCH -net] tls: return -EFAULT if copy_to_user() fails

2017-06-23 Thread Dan Carpenter
On Fri, Jun 23, 2017 at 03:31:44AM -0700, Joe Perches wrote: > On Fri, 2017-06-23 at 13:15 +0300, Dan Carpenter wrote: > > The copy_to_user() function returns the number of bytes remaining but we > > want to return -EFAULT here. > > because? Because it's a failure path? regards, dan carpenter

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

2017-06-23 Thread Dan Carpenter
The copy_to_user() function returns the number of bytes remaining but we want to return -EFAULT here. Fixes: 3c4d7559159b ("tls: kernel TLS support") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 2ebc328bda

Re: [PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct

2017-06-22 Thread Dan Carpenter
. I try to report bugs as soon as they are introduced. I report it to the author and CC the relevant list. If people don't respond to my email after a month then I complain again. regards, dan carpenter

Re: [PATCH][net-next] qtnfmac: fix uninitialized return code in ret

2017-06-21 Thread Dan Carpenter
pposed to be a special type of success return. Here it is just a fail return where we forgot to set the error code to ERR_PTR(-ENOMEM). regards, dan carpenter

[PATCH net-next] net/mlxfw: fix a NULL dereference

2017-06-14 Thread Dan Carpenter
If we hit this error path we end up returning ERR_PTR(0) which is NULL. The caller is not expecting that so it results in a NULL dereference. Fixes: 410ed13cae39 ("Add the mlxfw module for Mellanox firmware flash process") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com

[PATCH] xfrm: NULL dereference on allocation failure

2017-06-14 Thread Dan Carpenter
ce. Fixes: df71837d5024 ("[LSM-IPSec]: Security association restriction.") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/key/af_key.c b/net/key/af_key.c index 86051b5879f2..02e6865421e8 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -1157,

[PATCH] xfrm: Oops on error in pfkey_msg2xfrm_state()

2017-06-14 Thread Dan Carpenter
There are some missing error codes here so we accidentally return NULL instead of an error pointer. It results in a NULL pointer dereference. Fixes: df71837d5024 ("[LSM-IPSec]: Security association restriction.") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- T

[PATCH net] net/act_pedit: fix an error code

2017-06-14 Thread Dan Carpenter
using offset relative to the conventional network headers") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 164b5ac094be..7dc5892671c8 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -94,8 +94,10

[PATCH net-next] qed: Fix an off by one bug

2017-06-14 Thread Dan Carpenter
The p_l2_info->pp_qid_usage[] array has "p_l2_info->queues" elements so the > here should be a >= or we write beyond the end of the array. Fixes: bbe3f233ec5e ("qed: Assign a unique per-queue index to queue-cid") Signed-off-by: Dan Carpenter <dan.carpen...@or

Re: [PATCH] i40evf: remove redundant null check on key

2017-06-10 Thread Dan Carpenter
> Actually, it's the reverse. "key" is always NULL. Probably the || should be a &&? regards, dan carpenter

Re: [PATCH 2/2] vhost/scsi: Delete error messages for failed memory allocations in five functions

2017-05-22 Thread Dan Carpenter
ion. See slab_out_of_memory(). regards, dan carpenter

[PATCH net] bnxt_en: allocate enough space for ->ntp_fltr_bmap

2017-05-05 Thread Dan Carpenter
We have the number of longs, but we need to calculate the number of bytes required. Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethern

[PATCH] ipx: call ipxitf_put() in ioctl error path

2017-05-02 Thread Dan Carpenter
We should call ipxitf_put() if the copy_to_user() fails. Reported-by: 李强 <liqiang...@360.cn> Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 8a9219ff2e77..fa31ef29e3fa 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c

[PATCH net-next] lwtunnel: fix error path in lwtunnel_fill_encap()

2017-04-28 Thread Dan Carpenter
("lwtunnel: check return value of nla_nest_start") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c index 5cbed3816229..cfae3d5fe11f 100644 --- a/net/core/lwtunnel.c +++ b/net/core/lwtunnel.c @@ -203,7 +203,7 @@ int lwt

[PATCH net] liquidio: silence a locking static checker warning

2017-04-28 Thread Dan Carpenter
Presumably we never hit this return, but static checkers complain that we need to unlock so we may as well fix that. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c b/drivers/net/ethernet/cavium/liquidio/octeon_mai

[PATCH net] qed: Unlock on error in qed_vf_pf_acquire()

2017-04-28 Thread Dan Carpenter
My static checker complains that we're holding a mutex on this error path. Let's goto exit instead of returning directly. Fixes: b0bccb69eba3 ("qed: Change locking scheme for VF channel") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- Yuval, could you review this one

[PATCH net] ravb: Double free on error in ravb_start_xmit()

2017-04-22 Thread Dan Carpenter
If skb_put_padto() fails then it frees the skb. I shifted that code up a bit to make my error handling a little simpler. Fixes: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/renesa

[PATCH] net: tc35815: move free after the dereference

2017-04-21 Thread Dan Carpenter
We dereference "skb" to get "skb->len" so we should probably do that step before freeing the skb. Fixes: eea221ce4880 ("tc35815 driver update (take 2)") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/toshiba/tc

[PATCH] net: qrtr: potential use after free in qrtr_sendmsg()

2017-04-20 Thread Dan Carpenter
If skb_pad() fails then it frees the skb so we should check for errors. Fixes: bdabad3e363d ("net: Add Qualcomm IPC router") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index c36b0ec364a4..a9a8c7d5a4a9 100644 --- a/net/q

Re: [PATCH] dp83640: don't recieve time stamps twice

2017-04-19 Thread Dan Carpenter
; spin lock during the callback into the networking stack. Instead, how > about the following diff, which also fixes the other call site... > I'm fine with this. I hated my changelog, as well because it sounds like guess work. Could you send it with a: Reported-by: Dan Carpenter <dan.carpen..

[PATCH net-next] net/mlx5e: IPoIB, Fix error handling in mlx5_rdma_netdev_alloc()

2017-04-19 Thread Dan Carpenter
The labels were out of order, so it either could result in an Oops or a leak. Fixes: 48935bbb7ae8 ("net/mlx5e: IPoIB, Add netdevice profile skeleton") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c b/driv

[PATCH net-next] qede: allocate enough data for ->arfs_fltr_bmap

2017-04-19 Thread Dan Carpenter
We've got the number of longs, yes, but we should multiply by sizeof(long) to get the number of bytes needed. Fixes: e4917d46a653 ("qede: Add aRFS support") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- Btw, this driver use vmalloc() all over the place but k

Re: [PATCH][net-next] esp6: fix incorrect null pointer check on xo

2017-04-18 Thread Dan Carpenter
It's in Steffen's tree, not the networking tree and he's not CC'd. You should really be adding Fixes tags because it helps to ensure you CC the guilty parties. regards, dan carpenter

[PATCH] dp83640: don't recieve time stamps twice

2017-04-18 Thread Dan Carpenter
me that we would recieve the same data two times. I asked the author but never recieved a response. I can't test this code, but I'm pretty sure my patch is correct. Fixes: 4b063258ab93 ("dp83640: Delay scheduled work.") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> di

[PATCH -next] net: phy: test the right variable in phy_write_mmd()

2017-04-14 Thread Dan Carpenter
This is a copy and paste buglet. We meant to test for ->write_mmd but we test for ->read_mmd. Fixes: 1ee6b9bc6206 ("net: phy: make phy_(read|write)_mmd() generic MMD accessors") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/phy/phy-co

[PATCH block-tree] net: off by one in inet6_pton()

2017-04-13 Thread Dan Carpenter
If "scope_len" is sizeof(scope_id) then we would put the NUL terminator one space beyond the end of the buffer. Fixes: b1a951fe469e ("net/utils: generic inet_pton_with_scope helper") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- This one goes through Jens

Re: [PATCH] RDS: IB: ensure an initialized ret is printed in pr_warn message

2017-04-07 Thread Dan Carpenter
quot; is set to an error code. 567 pr_warn("RDS/IB: rds_ib_get_mr failed (errno=%d)\n", ret); 568 569 if (rds_ibdev) 570 rds_ib_dev_put(rds_ibdev); 571 572 return ibmr; 573 } regards, dan carpenter

[PATCH -next] qed: Add a missing error code

2017-04-03 Thread Dan Carpenter
We should be returning -ENOMEM if qed_mcp_cmd_add_elem() fails. The current code returns success. Fixes: 4ed1eea82a21 ("qed: Revise MFW command locking") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net

[PATCH -next] net: sched: choke: remove some dead code

2017-04-03 Thread Dan Carpenter
We accidentally left this dead code behind after commit 5952fde10c35 ("net: sched: choke: remove dead filter classify code"). Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index 040625fdc82b..f11f8732b0d5 100644

[PATCH -next] liquidio: clear the correct memory

2017-04-03 Thread Dan Carpenter
There is a cut and paste bug here so we accidentally clear the first few bytes of "resp" a second time instead clearing "ctx". Fixes: 50c0add534d2 ("liquidio: refactor interrupt moderation code") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff

[patch] sfc: cleanup a condition in efx_udp_tunnel_del()

2017-03-22 Thread Dan Carpenter
Presumably if there is an "add" function, there is also a "del" function. But it causes a static checker warning because it looks like a common cut and paste bug. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/sfc/efx.c b/driv

[patch -next] net: dwc-xlgmac: fix an error code in xlgmac_alloc_pages()

2017-03-21 Thread Dan Carpenter
The dma_mapping_error() returns true if there is an error but we want to return -ENOMEM and not 1. Fixes: 65e0ace2c5cd ("net: dwc-xlgmac: Initial driver for DesignWare Enterprise Ethernet") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ether

[PATCH] bna: integer overflow bug in debugfs

2017-03-17 Thread Dan Carpenter
We could allocate less memory than intended because we do: bnad->regdata = kzalloc(len << 2, GFP_KERNEL); The shift can overflow leading to a crash. This is debugfs code so the impact is very small. Fixes: 7afc5dbde091 ("bna: Add debugfs interface.") Signed-of

[patch] net/mlx4: && vs & typo

2017-02-28 Thread Dan Carpenter
Bitwise & was obviously intended here. Fixes: 745d8ae4622c ("net/mlx4: Spoofcheck and zero MAC can't coexist") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- Applies to net.git. diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h index e965e5

[bug report] dp83640: Delay scheduled work.

2017-02-27 Thread Dan Carpenter
something. 1443 } 1444 1445 return true; 1446 } regards, dan carpenter

[patch] sunrpc: silence uninitialized variable warning

2017-02-18 Thread Dan Carpenter
kstrtouint() can return a couple different error codes so the check for "ret == -EINVAL" is wrong and static analysis tools correctly complain that we can use "num" without initializing it. It's not super harmful because we check the bounds. But it's also easy enough to fix.

[patch] dpaa_eth: small leak on error

2017-02-16 Thread Dan Carpenter
This should be >= instead of > here. It means that we don't increment the free count enough so it becomes off by one. Fixes: 9ad1a3749333 ("dpaa_eth: add support for DPAA Ethernet") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- Applies to -net tree. di

Re: [patch net-next] net: qcom/emac: fix a sizeof() typo

2017-02-13 Thread Dan Carpenter
On Mon, Feb 13, 2017 at 12:55:03PM +0100, walter harms wrote: > > > Am 13.02.2017 12:00, schrieb Dan Carpenter: > > We had intended to say "sizeof(u32)" but the "u" is missing. > > Fortunately, sizeof(32) is also 4, so the original code still works. >

[patch net-next] net: qcom/emac: fix a sizeof() typo

2017-02-13 Thread Dan Carpenter
We had intended to say "sizeof(u32)" but the "u" is missing. Fortunately, sizeof(32) is also 4, so the original code still works. Fixes: c4e7beea2192 ("net: qcom/emac: add ethtool support for reading hardware registers") Signed-off-by: Dan Carpenter <dan.

[patch net-next] net: dsa: bcm_sf2: cleanup bcm_sf2_cfp_rule_get() a little

2017-02-07 Thread Dan Carpenter
needed and not consistent with the rest of the code. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c index c71be3e0dc2d..346dd9a1232d 100644 --- a/drivers/net/dsa/bcm_sf2_cfp.c +++ b/drivers/net/dsa/bcm_sf2_cfp.c @@ -44

[patch v2 net-next] sfc: fix an off by one bug

2017-02-06 Thread Dan Carpenter
This bug is harmless because it's just a sanity check and we always pass valid values for "encap_type" but the test is off by one. Fixes: 9b4108012517 ("sfc: insert catch-all filters for encapsulated traffic") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --

[patch net-next] net/mlx4_en: fix a condition

2017-02-03 Thread Dan Carpenter
There is a "||" vs "|" typo here so we test 0x1 instead of 0x6. Fixes: 1f8176f7352a ("net/mlx4_en: Check the enabling pptx/pprx flags in SET_PORT wrapper flow") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/mellanox

[patch net-next] ethernet: aquantia: fix dma_mapping_error test

2017-02-01 Thread Dan Carpenter
dma_mapping_error() returns 1 if there is an error and 0 if not. Fixes: 018423e90bee ("net: ethernet: aquantia: Add ring support code") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/a

[patch net-next] sfc: a couple off by one bugs

2017-02-01 Thread Dan Carpenter
These checks are off by one. These are just sanity checks and we don't ever pass invalid values for "encap_type" so it's harmless. Fixes: 9b4108012517 ("sfc: insert catch-all filters for encapsulated traffic") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>

[patch] ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()

2017-02-01 Thread Dan Carpenter
Casting is a high precedence operation but "off" and "i" are in terms of bytes so we need to have some parenthesis here. Fixes: fbfa743a9d2a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --gi

Re: [patch net-next] smc: some potential use after free bugs

2017-01-26 Thread Dan Carpenter
On Thu, Jan 26, 2017 at 12:23:02PM +0100, Ursula Braun wrote: > > On 01/26/2017 10:05 AM, Dan Carpenter wrote: > > Say we got really unlucky and these failed on the last iteration, then > > it could lead to a use after free bug. > thanks for reporting this! I had already a s

[patch net-next] smc: some potential use after free bugs

2017-01-26 Thread Dan Carpenter
Say we got really unlucky and these failed on the last iteration, then it could lead to a use after free bug. Fixes: cd6851f30386 ("smc: remote memory buffers (RMBs)") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c in

Re: [patch net-next] sctp: fix some debug output

2017-01-24 Thread Dan Carpenter
On Tue, Jan 24, 2017 at 07:14:11AM -0200, Marcelo Ricardo Leitner wrote: > On Tue, Jan 24, 2017 at 12:05:40PM +0300, Dan Carpenter wrote: > > We added SCTP_EVENT_TIMEOUT_RECONF but we didn't update this array so > > it causes an off-by-one read overflow. > > > > Fixe

Re: [patch net-next] sctp: fix some debug output

2017-01-24 Thread Dan Carpenter
On Tue, Jan 24, 2017 at 07:14:11AM -0200, Marcelo Ricardo Leitner wrote: > On Tue, Jan 24, 2017 at 12:05:40PM +0300, Dan Carpenter wrote: > > We added SCTP_EVENT_TIMEOUT_RECONF but we didn't update this array so > > it causes an off-by-one read overflow. > > > > Fixe

[patch net-next] tipc: uninitialized return code in tipc_setsockopt()

2017-01-24 Thread Dan Carpenter
We shuffled some code around and added some new case statements here and now "res" isn't initialized on all paths. Fixes: 01fd12bb189a ("tipc: make replicast a user selectable option") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/tipc/so

[patch net-next] sctp: fix some debug output

2017-01-24 Thread Dan Carpenter
We added SCTP_EVENT_TIMEOUT_RECONF but we didn't update this array so it causes an off-by-one read overflow. Fixes: 7b9438de0cd4 ("sctp: add stream reconf timer") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/net/sctp/debug.c b/net/sctp/debug.c in

Re: [patch] samples/bpf: silence shift wrapping warning

2017-01-24 Thread Dan Carpenter
On Mon, Jan 23, 2017 at 10:44:34PM -0800, Alexei Starovoitov wrote: > On Mon, Jan 23, 2017 at 5:27 AM, Arnaldo Carvalho de Melo > <arnaldo.m...@gmail.com> wrote: > > Em Sun, Jan 22, 2017 at 02:51:25PM -0800, Alexei Starovoitov escreveu: > >> On Sat, Jan 21, 2017 at 07:5

Re: [patch net-next] stmmac: indent an if statement

2017-01-16 Thread Dan Carpenter
On Mon, Jan 16, 2017 at 10:46:22PM +0100, Julia Lawall wrote: > > > On Mon, 16 Jan 2017, Dan Carpenter wrote: > > > On Mon, Jan 16, 2017 at 12:19:24PM +0300, Dan Carpenter wrote: > > > On Sun, Jan 15, 2017 at 10:14:38PM -0500, David Miller wrote: > > &g

Re: [patch net-next] stmmac: indent an if statement

2017-01-16 Thread Dan Carpenter
On Mon, Jan 16, 2017 at 12:19:24PM +0300, Dan Carpenter wrote: > On Sun, Jan 15, 2017 at 10:14:38PM -0500, David Miller wrote: > > From: Dan Carpenter <dan.carpen...@oracle.com> > > Date: Thu, 12 Jan 2017 21:46:32 +0300 > > > > > The break state

Re: [patch net-next] stmmac: indent an if statement

2017-01-16 Thread Dan Carpenter
On Sun, Jan 15, 2017 at 10:14:38PM -0500, David Miller wrote: > From: Dan Carpenter <dan.carpen...@oracle.com> > Date: Thu, 12 Jan 2017 21:46:32 +0300 > > > The break statement should be indented one more tab. > > > > Signed-off-by: Dan Carpenter <dan.carpen..

[patch net-next] stmmac: indent an if statement

2017-01-12 Thread Dan Carpenter
The break statement should be indented one more tab. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index ac32f9e..4daa8a3 100644 --- a/drivers/net/et

[patch net-next] irda: w83977af_ir: cleanup an indent issue

2016-12-12 Thread Dan Carpenter
In commit 99d8d2159d7c ("irda: w83977af_ir: Neaten logging"), we accidentally added an extra tab to these lines. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index f293d33fb28f..8d5

[patch] ser_gigaset: return -ENOMEM on error instead of success

2016-12-07 Thread Dan Carpenter
If we can't allocate the resources in gigaset_initdriver() then we should return -ENOMEM instead of zero. Fixes: 2869b23e4b95 ("[PATCH] drivers/isdn/gigaset: new M101 driver (v2)") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- Ancient code. diff --git a/drivers/

[patch net-next] net: mvneta: Indent some statements

2016-12-07 Thread Dan Carpenter
These two statements were not indented correctly so it's sort of confusing. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 5e5b259dd2cc..e05e22705cf7 100644 --- a/drivers/net/et

[patch] drivers: net: xgene: uninitialized variable in xgene_enet_free_pagepool()

2016-12-07 Thread Dan Carpenter
We never set "slots" in this function. Fixes: a9380b0f7be8 ("drivers: net: xgene: Add support for Jumbo frame") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- I copied how slots gets set in xgene_enet_rx_frame(). Static analysis. Not tested. diff --git

[patch] net: renesas: ravb: unintialized return value

2016-12-01 Thread Dan Carpenter
We want to set the other "err" variable here so that we can return it later. My version of GCC misses this issue but I caught it with a static checker. Fixes: 9f70eb339f52 ("net: ethernet: renesas: ravb: fix fixed-link phydev leaks") Signed-off-by: Dan Carpenter <d

[patch v2 net-next] sfc: remove unneeded variable

2016-11-25 Thread Dan Carpenter
We don't use ->heap_buf after commit 46d1efd852cc ("sfc: remove Software TSO") so let's remove the last traces. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index f97f

Re: [patch net-next] sfc: remove unneeded variable

2016-11-24 Thread Dan Carpenter
On Thu, Nov 24, 2016 at 01:22:24PM +, Edward Cree wrote: > On 24/11/16 11:16, Dan Carpenter wrote: > > We don't use ->heap_buf after commit 46d1efd852cc ("sfc: remove Software > > TSO") so let's remove the last traces. > > > > Signed-off-by:

[patch -next] cxgb4: leak on error path in setup_sge_txq_uld()

2016-11-24 Thread Dan Carpenter
Freeing "txq_info->uldtxq" is a no-op. We intended to free "txq_info". Fixes: ab677ff4ad15 ("cxgb4: Allocate Tx queues dynamically") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.

[patch] fsl/fman: fix a leak in tgec_free()

2016-11-24 Thread Dan Carpenter
We set "tgec->cfg" to NULL before passing it to kfree(). There is no need to set it to NULL at all. Let's just delete it. Fixes: 57ba4c9b56d8 ("fsl/fman: Add FMan MAC support") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- I haven't tested this. I

[patch net-next] sfc: remove unneeded variable

2016-11-24 Thread Dan Carpenter
We don't use ->heap_buf after commit 46d1efd852cc ("sfc: remove Software TSO") so let's remove the last traces. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index f97f

[patch] net/mlx5: remove a duplicate condition

2016-11-24 Thread Dan Carpenter
We verified that MLX5_FLOW_CONTEXT_ACTION_COUNT was set on the first line of the function so we don't need to check again here. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- Not a bugfix so it would go into -next diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cor

[patch net-next] liquidio CN23XX: bitwise vs logical AND typo

2016-11-18 Thread Dan Carpenter
We obviously intended a bitwise AND here, not a logical one. Fixes: 8c978d059224 ("liquidio CN23XX: Mailbox support") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c b/drivers/net/ethernet

[patch] amd-xgbe: Signedness bug in xgbe_phy_link_status()

2016-11-17 Thread Dan Carpenter
"ret" needs to be signed for the error handling to work. Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/x

Re: [PATCH (net.git)] stmmac: fix and review the ptp registration.

2016-10-19 Thread Dan Carpenter
Looks good. This actually fixes my commit where I changed the return PTR_ERR(NULL) which means success to PTR_ERR(-ESOMETHING). Unintentionally returning success was the correct behavior. regards, dan carpenter

[patch] stmmac: fix an error code in stmmac_ptp_register()

2016-10-14 Thread Dan Carpenter
PTR_ERR(NULL) is success. We have to preserve the error code earlier. Fixes: 7086605a6ab5 ("stmmac: fix error check when init ptp") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> --- Applies to net.git tree. diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.

[patch] liquidio: CN23XX: fix a loop timeout

2016-10-13 Thread Dan Carpenter
This is supposed to loop 1000 times and then give up. The problem is it's a post-op and after the loop we test if "loop" is zero when really it would be -1. Fix this by making it a pre-op. Fixes: 1b7c55c4538b ("liquidio: CN23XX queue manipulation") Signed-off-by: Dan C

<    1   2   3   4   >