aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorXiaoming Ni <nixiaoming@huawei.com>2021-01-04 12:07:38 +0800
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-02-10 08:36:17 -0300
commite604a5e4bb61267c58e6b6179209efe74ab5f675 (patch)
tree36f6a102ad8826dd3bc7f2314ab9407f57bfc82f /include
parent7960c5eea936185dfa9aeaad81b28dbfb53521dd (diff)
downloadglibc-e604a5e4bb61267c58e6b6179209efe74ab5f675.zip
glibc-e604a5e4bb61267c58e6b6179209efe74ab5f675.tar.gz
glibc-e604a5e4bb61267c58e6b6179209efe74ab5f675.tar.bz2
setrlimit/getrlimit: Use __nonnull to avoid null pointer
Add __nonnull((2)) to the setrlimit()/getrlimit() function declaration to avoid null pointer access. ----- v2 According to the suggestions of the Adhemerval Zanella and Zack Weinberg: use __nonnull() to check null pointers in the compilation phase. do not add pointer check code to setrlimit()/getrlimit(). The validity of the "resource" parameter is checked in the syscall. v1 https://public-inbox.org/libc-alpha/20201230114131.47589-1-nixiaoming@huawei.com/ ----- Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/sys/resource.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/sys/resource.h b/include/sys/resource.h
index 2235b02..21d3908 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -126,13 +126,13 @@ libc_hidden_proto (__getrlimit64);
/* Now define the internal interfaces. */
extern int __getrlimit (enum __rlimit_resource __resource,
- struct rlimit *__rlimits);
+ struct rlimit *__rlimits) __nonnull ((2));
libc_hidden_proto (__getrlimit)
extern int __getrusage (enum __rusage_who __who, struct rusage *__usage)
attribute_hidden;
extern int __setrlimit (enum __rlimit_resource __resource,
- const struct rlimit *__rlimits);
+ const struct rlimit *__rlimits) __nonnull ((2));
libc_hidden_proto (__setrlimit);
#if __TIMESIZE == 64