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
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
abel() 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/
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/
e have a call
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
---
ne
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
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
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.
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
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/c
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
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
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
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
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
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
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
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
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
++
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 --gi
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
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
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
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
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
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
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
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
--- a
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
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
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 +---
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
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
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:
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
54 matches
Mail list logo