* [PATCH] ima: fix showing large 'violations' or 'runtime_measurements_count'
@ 2018-09-07 21:33 Eric Biggers
2018-09-21 19:37 ` Mimi Zohar
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2018-09-07 21:33 UTC (permalink / raw)
To: linux-integrity, Mimi Zohar, Dmitry Kasatkin
From: Eric Biggers <ebiggers@google.com>
The 12 character temporary buffer is not necessarily long enough to hold
a 'long' value. Increase it.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
security/integrity/ima/ima_fs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
index fe0ede883557..9e239b1dea2f 100644
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -42,14 +42,14 @@ static int __init default_canonical_fmt_setup(char *str)
__setup("ima_canonical_fmt", default_canonical_fmt_setup);
static int valid_policy = 1;
-#define TMPBUFLEN 12
+
static ssize_t ima_show_htable_value(char __user *buf, size_t count,
loff_t *ppos, atomic_long_t *val)
{
- char tmpbuf[TMPBUFLEN];
+ char tmpbuf[32];
ssize_t len;
- len = scnprintf(tmpbuf, TMPBUFLEN, "%li\n", atomic_long_read(val));
+ len = scnprintf(tmpbuf, sizeof(tmpbuf), "%li\n", atomic_long_read(val));
return simple_read_from_buffer(buf, count, ppos, tmpbuf, len);
}
--
2.19.0.rc2.392.g5ba43deb5a-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ima: fix showing large 'violations' or 'runtime_measurements_count'
2018-09-07 21:33 [PATCH] ima: fix showing large 'violations' or 'runtime_measurements_count' Eric Biggers
@ 2018-09-21 19:37 ` Mimi Zohar
0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2018-09-21 19:37 UTC (permalink / raw)
To: Eric Biggers, linux-integrity, Mimi Zohar, Dmitry Kasatkin
On Fri, 2018-09-07 at 14:33 -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> The 12 character temporary buffer is not necessarily long enough to hold
> a 'long' value. Increase it
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> security/integrity/ima/ima_fs.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
> index fe0ede883557..9e239b1dea2f 100644
> --- a/security/integrity/ima/ima_fs.c
> +++ b/security/integrity/ima/ima_fs.c
> @@ -42,14 +42,14 @@ static int __init default_canonical_fmt_setup(char *str)
> __setup("ima_canonical_fmt", default_canonical_fmt_setup);
>
> static int valid_policy = 1;
> -#define TMPBUFLEN 12
> +
> static ssize_t ima_show_htable_value(char __user *buf, size_t count,
> loff_t *ppos, atomic_long_t *val)
> {
> - char tmpbuf[TMPBUFLEN];
> + char tmpbuf[32];
The maximum string size needed to represent a long is not 32, even on
a 64 bit system. 32 bytes is fine, but please comment this.
> ssize_t len;
>
> - len = scnprintf(tmpbuf, TMPBUFLEN, "%li\n", atomic_long_read(val));
> + len = scnprintf(tmpbuf, sizeof(tmpbuf), "%li\n", atomic_long_read(val));
> return simple_read_from_buffer(buf, count, ppos, tmpbuf, len);
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-22 1:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-07 21:33 [PATCH] ima: fix showing large 'violations' or 'runtime_measurements_count' Eric Biggers
2018-09-21 19:37 ` Mimi Zohar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).