summaryrefslogtreecommitdiff
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorEmese Revfy <re.emese@gmail.com>2016-07-26 22:41:43 +0200
committerKees Cook <keescook@chromium.org>2017-02-06 13:26:31 -0800
commite89c98504d8962186caa82a7f613a6d0b24cb917 (patch)
tree6174c271746c30108b5e63c113cb1221bb1d168c /lib/vsprintf.c
parentdc259d15102b74f87f23166491aeb7b99ecf4da1 (diff)
initify: Mark functions with the __nocapture attribute
The nocapture gcc attribute can be on functions only. The attribute takes zero or more signed integer constants as parameters that specify the function parameters to initify when the passed arguments are of const char* type. A negative attribute parameter value means that the corresponding function parameter is returned by the function and the passed argument will only be initified if the data flow of the returned value is not captured in the caller. If no values are passed to the attribute then all function parameters are treated as nocapture. If the marked parameter is a vararg then the plugin initifies all vararg arguments. Signed-off-by: Emese Revfy <re.emese@gmail.com> [kees: updated markings, thanks to Arnd] Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 0967771d8f7f..a192761d338a 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -118,7 +118,7 @@ long long simple_strtoll(const char *cp, char **endp, unsigned int base)
}
EXPORT_SYMBOL(simple_strtoll);
-static noinline_for_stack
+static noinline_for_stack __nocapture(1)
int skip_atoi(const char **s)
{
int i = 0;
@@ -1570,7 +1570,7 @@ int kptr_restrict __read_mostly;
* function pointers are really function descriptors, which contain a
* pointer to the real address.
*/
-static noinline_for_stack
+static noinline_for_stack __nocapture(1)
char *pointer(const char *fmt, char *buf, char *end, void *ptr,
struct printf_spec spec)
{
@@ -1749,7 +1749,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
* @precision: precision of a number
* @qualifier: qualifier of a number (long, size_t, ...)
*/
-static noinline_for_stack
+static noinline_for_stack __nocapture(1)
int format_decode(const char *fmt, struct printf_spec *spec)
{
const char *start = fmt;