[PATCH] drivers/nouveau_svm: fix bounds check in nouveau_svm_fault_buffer_dtor

2020-08-16 Thread Gaurav Singh
do the bounds check before accessing the buffer element. Fixes: eeaf06ac1a558 ("drm/nouveau/svm: initial support for shared virtual memory") Signed-off-by: Gaurav Singh --- drivers/gpu/drm/nouveau/nouveau_svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drive

[PATCH] net/failover: remove redundant fops null check

2020-08-08 Thread Gaurav Singh
Remove redundant fops null check Fixes: 30c8bd5aa8b2c ("net: Introduce generic failover module") Signed-off-by: Gaurav Singh --- net/core/failover.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/failover.c b/net/core/failover.c index b5cd3c727285..63

[PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-08-08 Thread Gaurav Singh
wlabel() that accesses np without check which may cause a segment violation. Fixes: 513674b5a2c9c ("net: reevalulate autoflowlabel setting after sysctl setting") Signed-off-by: Gaurav Singh --- net/ipv6/ip6_output.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/i

[PATCH] [net/ethtool] ethnl_set_linkmodes: remove redundant null check

2020-07-30 Thread Gaurav Singh
info cannot be NULL here since its being accessed earlier in the function: nlmsg_parse(info->nlhdr...). Remove this redundant NULL check. Signed-off-by: Gaurav Singh --- net/ethtool/linkmodes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ethtool/linkmodes.c b/

[PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-27 Thread Gaurav Singh
all ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel, ip6_autoflowlabel(net, np), fl6)); . Hence np = NULL gets passed in the function ip6_autoflowlabel() which accesses np-> without check which may cause a segment violation. Signed-off-by: Gaurav Singh --- net/ipv6/ip6

[PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-26 Thread Gaurav Singh
ipv6_pinfo is initlialized by inet6_sk() which returns NULL. Hence it can cause segmentation fault. Fix this by adding a NULL check. Signed-off-by: Gaurav Singh --- net/ipv6/ip6_output.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv6/ip6_output.c b/net/ipv6

[PATCH] netfilter: ip6tables: Remove redundant null checks

2020-07-26 Thread Gaurav Singh
netfilter: ip6tables: Remove redundant null checks Signed-off-by: Gaurav Singh --- net/ipv6/netfilter/ip6t_ah.c | 3 +-- net/ipv6/netfilter/ip6t_frag.c | 3 +-- net/ipv6/netfilter/ip6t_hbh.c | 3 +-- net/ipv6/netfilter/ip6t_rt.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions

[PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference

2020-07-25 Thread Gaurav Singh
Function mbxfb_debugfs_remove() accesses fbi->par without NULL check, hence do the NULL check in the caller mbxfb_remove(). Signed-off-by: Gaurav Singh --- drivers/video/fbdev/mbx/mbxfb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/fbdev/mbx/mbxfb.

[PATCH] [video/fbdev] fb_flashcursor: Remove redundant null check

2020-07-25 Thread Gaurav Singh
ops cannot be NULL as its being accessed later without checks. Remove the redundant NULL check. Signed-off-by: Gaurav Singh --- drivers/video/fbdev/core/fbcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core

[PATCH] [cgroup/testing] cg_read_strcmp: Fix null pointer dereference

2020-07-25 Thread Gaurav Singh
Haven't reproduced this issue. This PR is does a minor code cleanup. Signed-off-by: Gaurav Singh --- tools/testing/selftests/cgroup/cgroup_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup

[PATCH] [cgroup/testing] cg_read_strcmp: Fix null pointer dereference

2020-07-25 Thread Gaurav Singh
Passing NULL in strcmp will cause a segmentation fault. Fix this by returning -1 if expected is NULL pointer. Signed-off-by: Gaurav Singh --- tools/testing/selftests/cgroup/cgroup_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/cgroup

[PATCH] [scripts] read_file: fix memory leak

2020-06-28 Thread Gaurav Singh
Free buf before returning to avoid memory leak. Signed-off-by: Gaurav Singh --- scripts/insert-sys-cert.c | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/insert-sys-cert.c b/scripts/insert-sys-cert.c index 8902836c2342..22d99a8faca9 100644 --- a/scripts/insert-sys-cert.c +++ b

[PATCH] [net/ipv6] Remove redundant null check in rt_mt6

2020-06-24 Thread Gaurav Singh
rh cannot be NULL here since its already checked above assignment and is being dereferenced before. Remove the redundant null check. Signed-off-by: Gaurav Singh --- net/ipv6/netfilter/ip6t_rt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/netfilter/ip6t_rt.c b

[PATCH] [net/ipv6] Remove redundant null check in hbh_mt6

2020-06-24 Thread Gaurav Singh
oh cannot be NULL since its already checked above after assignment and is being dereferenced before. Remove the redundant null check. Signed-off-by: Gaurav Singh --- net/ipv6/netfilter/ip6t_hbh.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/netfilter/ip6t_hbh.c

[PATCH] [net/ipv6] remove redundant null check in frag_mt6

2020-06-24 Thread Gaurav Singh
fh cannot be NULL since its already checked above after assignment and is being dereferenced before. Remove the redundant null check. Signed-off-by: Gaurav Singh --- net/ipv6/netfilter/ip6t_frag.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/netfilter

[PATCH] [net/ipv6] Remove redundant null check in ah_mt6

2020-06-24 Thread Gaurav Singh
ah cannot be NULL since its already checked above after assignment and is being dereferenced before in pr(). Remove the redundant null check. Signed-off-by: Gaurav Singh --- net/ipv6/netfilter/ip6t_ah.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/netfilter

[PATCH] [drivers/x86] fix bound check in pmc_core_mphy_pg_show

2020-06-23 Thread Gaurav Singh
Check bounds before accessing map[]. Signed-off-by: Gaurav Singh --- drivers/platform/x86/intel_pmc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index 7c8bdab078cf..f571f9cf7217 100644

[PATCH] [perf] lsdir_bid_tail_filter: fix index check

2020-06-23 Thread Gaurav Singh
Check bounds before accessing d->d_name[]. Signed-off-by: Gaurav Singh --- tools/perf/util/build-id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index c076fc7fe025..8c35cbe93f10 100644 --- a/tools/perf/util/bu

[PATCH] [net/wan] cosa_init: check bounds before access

2020-06-23 Thread Gaurav Singh
Check i < io bounds before accessing io[i]. Signed-off-by: Gaurav Singh --- drivers/net/wan/cosa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 5d6532ad6b78..8797adfa0ab0 100644 --- a/drivers/net/wan/cosa.c ++

[PATCH] [net/ethernet] do_reset: remove dev null check

2020-06-23 Thread Gaurav Singh
dev cannot be NULL here since its already being accessed before. Remove the redundant null check. Signed-off-by: Gaurav Singh --- drivers/net/ethernet/xircom/xirc2ps_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net

[PATCH] [perf] intel_pt_recording_options: Remove redundant intel_pt_evsel null check

2020-06-23 Thread Gaurav Singh
intel_pt_evsel cannot be NULL here since its already being dereferenced above. Remove this redundant check. Signed-off-by: Gaurav Singh --- tools/perf/arch/x86/util/intel-pt.c | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tools/perf/arch/x86/util

[PATCH] [net/decnet] dn_route_rcv: remove redundant dev null check

2020-06-22 Thread Gaurav Singh
dev cannot be NULL here since its already being accessed before. Remove the redundant null check. Signed-off-by: Gaurav Singh --- net/decnet/dn_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 06b9983325cc

[PATCH] [net] dcb_doit: remove redundant skb check

2020-06-22 Thread Gaurav Singh
skb cannot be NULL here since its already being accessed before: sock_net(skb->sk). Remove the redundant null check. Signed-off-by: Gaurav Singh --- net/dcb/dcbnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index d2a4553bc

[PATCH] [net/sched] tcindex_change: Remove redundant null check

2020-06-21 Thread Gaurav Singh
arg cannot be NULL since its already being dereferenced before. Remove the redundant NULL check. Signed-off-by: Gaurav Singh --- net/sched/cls_tcindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 61e95029c18f

[PATCH] [objtoo] fix memory leak in special_get_alts

2020-06-21 Thread Gaurav Singh
Free alt before returning to avoid memory leak. Signed-off-by: Gaurav Singh --- tools/objtool/special.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/objtool/special.c b/tools/objtool/special.c index e74e0189de22..f6f7dee1ba77 100644 --- a/tools/objtool/special.c

[PATCH] [x86] overlap: cleanup redundant logic

2020-06-21 Thread Gaurav Singh
In overlap check, same expression is repeated twice. Remove one of them. Signed-off-by: Gaurav Singh --- arch/x86/mm/pat/set_memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c index 77e04304a2a7

[PATCH] [net] dcb_doit: remove redundant skb check

2020-06-21 Thread Gaurav Singh
Remove the redundant null check for skb. Signed-off-by: Gaurav Singh --- net/dcb/dcbnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index d2a4553bcf39..84dde5a2066e 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1736,7 +1736,7

[PATCH] Fix check in ethtool_rx_flow_rule_create

2020-06-21 Thread Gaurav Singh
Fix check in ethtool_rx_flow_rule_create Signed-off-by: Gaurav Singh --- net/ethtool/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index b5df90c981c2..21d5fc0f6bb3 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c

[PATCH] max732x_probe: remove redundant check

2020-06-20 Thread Gaurav Singh
The pdata is already checked for its validity. Remove the redundant check. Signed-off-by: Gaurav Singh --- drivers/gpio/gpio-max732x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 5fb0bcf31142..63472f308857

[PATCH] [net/sched] Remove redundant skb null check

2020-06-19 Thread Gaurav Singh
Remove the redundant null check for skb. Signed-off-by: Gaurav Singh --- net/sched/act_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 8ac7eb0a8309..90be8fe9128c 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c

[PATCH] [net/sched]: Remove redundant condition in qdisc_graft

2020-06-18 Thread Gaurav Singh
parent cannot be NULL here since its in the else part of the if (parent == NULL) condition. Remove the extra check on parent pointer. Signed-off-by: Gaurav Singh --- net/sched/sch_api.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/sched/sch_api.c b/net/sched

[PATCH] [net/sched]: Remove redundant condition in qdisc_graft

2020-06-17 Thread Gaurav Singh
parent cannot be NULL here since its in the else part of the if (parent == NULL) condition. Remove the extra check on parent pointer. Signed-off-by: Gaurav Singh --- net/sched/sch_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c

[PATCH] [net/sched]: Remove redundant condition in qdisc_graft

2020-06-17 Thread Gaurav Singh
Signed-off-by: Gaurav Singh Fix build errors Signed-off-by: Gaurav Singh --- net/sched/sch_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 9a3449b56bd6..be93ebcdb18d 100644 --- a/net/sched/sch_api.c +++ b/net/sched

[PATCH] [net/sched] Fix null pointer deref skb in tc_ctl_action

2020-06-17 Thread Gaurav Singh
Add null check for skb Signed-off-by: Gaurav Singh --- net/sched/act_api.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 8ac7eb0a8309..fd584821d75a 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -1473,9

[PATCH] [net/sched]: Remove redundant condition in qdisc_graft

2020-06-17 Thread Gaurav Singh
parent cannot be NULL here since its in the else part of the if (parent == NULL) condition. Remove the extra check on parent pointer. Signed-off-by: Gaurav Singh --- net/sched/sch_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c

[PATCH] [perf] Fix null pointer deference in nest_epollfd

2020-06-17 Thread Gaurav Singh
Add a NULL check for worker before dereferencing. Signed-off-by: Gaurav Singh --- tools/perf/bench/epoll-wait.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/bench/epoll-wait.c b/tools/perf/bench/epoll-wait.c index 75dca9773186..42983eb7f82e 100644 --- a/tools/perf/bench

[PATCH] [perf] sort : Fix null pointer dereference in _hist_entry__sym_snprintf

2020-06-17 Thread Gaurav Singh
The pointer ms can be NULL. Add null check before dereferencing it to avoid segmentation fault. Signed-off-by: Gaurav Singh --- tools/perf/util/sort.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index d42339df20f8..25c7c96893f6 100644

[PATCH] ia64: Add null pointer check for task in default_handler

2020-06-17 Thread Gaurav Singh
If the task is NULL and the if condition is true then task->pid would cause null pointer dereference. Fix this by adding additional null check. Signed-off-by: Gaurav Singh --- arch/ia64/kernel/perfmon_default_smpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/i

[PATCH] max732x_probe: remove redundant check

2020-06-17 Thread Gaurav Singh
The check : if (pdata) is redundant since its already dereferenced before: pdata->have_64bit_regs; pdata is not initialized after that hence remove this null check. Signed-off-by: Gaurav Singh --- drivers/gpio/gpio-max732x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --

[PATCH] [bpf] xdp_redirect_cpu_user: Fix null pointer dereference

2020-06-14 Thread Gaurav Singh
Memset() on the pointer right after malloc() can cause a null pointer dereference if it failed to allocate memory. Fix this by replacing malloc/memset with a single calloc(). Signed-off-by: Gaurav Singh --- samples/bpf/xdp_redirect_cpu_user.c | 11 +++ 1 file changed, 3 insertions(+), 8

[PATCH] [bpf] xdp_monitor_user: Fix null pointer dereference

2020-06-14 Thread Gaurav Singh
Memset() on the pointer right after malloc() can cause a null pointer dereference if it failed to allocate memory. Fix this by replacing malloc/memset with a single calloc(). Signed-off-by: Gaurav Singh --- samples/bpf/xdp_monitor_user.c | 8 ++-- 1 file changed, 2 insertions(+), 6

[PATCH] [traceevent] add_new_comm(): Fix memory leak

2020-06-14 Thread Gaurav Singh
The pointer cmdlines need to be explicity freed in case the realloc() fails. Fix it by adding a free() if realloc() returns a NULL pointer. Signed-off-by: Gaurav Singh --- tools/lib/traceevent/event-parse.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/lib

[PATCH] Fix null pointer dereference in vector_user_bpf

2020-06-13 Thread Gaurav Singh
The bpf_prog is being checked for !NULL after uml_kmalloc but later its used directly for example: bpf_prog->filter = bpf and is also later returned upon success. Fix this, do a NULL check and return right away. Signed-off-by: Gaurav Singh --- arch/um/drivers/vector_user.c | 8 +--- 1 f

[PATCH] xdp_rxq_info_user: Fix null pointer dereference. Replace malloc/memset with calloc.

2020-06-12 Thread Gaurav Singh
Memset on the pointer right after malloc can cause a null pointer deference if it failed to allocate memory. A simple fix is to replace malloc/memset with a calloc() Fixes: 0fca931a6f21 ("samples/bpf: program demonstrating access to xdp_rxq_info") Signed-off-by: Gaurav Singh --- s

[PATCH] xdp_rxq_info_user: Replace malloc/memset w/calloc

2020-06-11 Thread Gaurav Singh
Replace malloc/memset with calloc Fixes: 0fca931a6f21 ("samples/bpf: program demonstrating access to xdp_rxq_info") Signed-off-by: Gaurav Singh --- samples/bpf/xdp_rxq_info_user.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/samples/bpf/xdp_rxq_i

[PATCH] xdp_rxq_info_user: Replace malloc/memset w/calloc

2020-06-11 Thread Gaurav Singh
Replace malloc/memset with calloc Fixes: 0fca931a6f21 ("samples/bpf: program demonstrating access to xdp_rxq_info") Signed-off-by: Gaurav Singh --- samples/bpf/xdp_rxq_info_user.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/samples/bpf/xdp_rxq_i

[PATCH] xdp_rxq_info_user: Replace malloc/memset w/calloc

2020-06-11 Thread Gaurav Singh
Replace malloc/memset with calloc Signed-off-by: Gaurav Singh --- samples/bpf/xdp_rxq_info_user.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c index 4fe47502ebed..caa4e7ffcfc7 100644

[PATCH] Fix null pointer dereference in vector_user_bpf

2020-06-10 Thread Gaurav Singh
The bpf_prog is being checked for !NULL after uml_kmalloc but later its used directly for example: bpf_prog->filter = bpf and is also later returned upon success. Fix this, do a NULL check and return right away. Signed-off-by: Gaurav Singh --- arch/um/drivers/vector_user.c | 8 +--- 1 f

[PATCH] max732x_probe: remove redundant check

2020-06-10 Thread Gaurav Singh
Signed-off-by: Gaurav Singh The pdata is already checked for its validity. Remove this redundant check. --- drivers/gpio/gpio-max732x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 5fb0bcf31142..63472f308857

[PATCH] Fix null pointer dereference in vector_user_bpf

2020-06-09 Thread Gaurav Singh
Signed-off-by: Gaurav Singh The bpf_prog is being checked for !NULL after uml_kmalloc but later its used directly for example: bpf_prog->filter = bpf and is also later returned upon success. Fix this, do a NULL check and return right away. --- arch/um/drivers/vector_user.c | 8 +---

[PATCH] xdp_rxq_info_user: Add null check after malloc

2020-06-09 Thread Gaurav Singh
Signed-off-by: Gaurav Singh The memset call is made right after malloc call which can return a NULL pointer upon failure causing a segmentation fault. Fix this by adding a null check right after malloc() and then do memset(). --- samples/bpf/xdp_rxq_info_user.c | 6 +++--- 1 file changed, 3

[PATCH] bpf: alloc_record_per_cpu Add null check after malloc

2020-06-09 Thread Gaurav Singh
The memset call is made right after malloc call. To fix this, add the null check right after malloc and then do memset. Signed-off-by: Gaurav Singh --- samples/bpf/xdp_rxq_info_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples

[no subject]

2020-06-09 Thread Gaurav Singh
Please find the patch below. Thanks and regards, Gaurav. >From Gaurav Singh # This line is ignored. From: Gaurav Singh Reply-To: Subject: In-Reply-To:

[PATCH] bpf: alloc_record_per_cpu Add null check after malloc

2020-06-09 Thread Gaurav Singh
Signed-off-by: Gaurav Singh --- samples/bpf/xdp_rxq_info_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c index 4fe47502ebed..490b07b7df78 100644 --- a/samples/bpf/xdp_rxq_info_user.c +++ b/samples/bpf