lkml.org 
[lkml]   [2008]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch 5/5]integrity: IMA as an integrity service provider
On Wed, 16 Jul 2008, Mimi Zohar wrote:


> +static ssize_t ima_show_htable_value(char __user *buf, size_t count,
> + loff_t *ppos, atomic_t *val)
> +{
> + char tmpbuf[TMPBUFLEN];
> + ssize_t len;
> +
> + len = scnprintf(tmpbuf, TMPBUFLEN, "%i\n", atomic_read(val));
> + return simple_read_from_buffer(buf, count, ppos, tmpbuf, len);
> +}
> +
> +static ssize_t ima_show_htable_violations(struct file *filp,
> + char __user *buf,
> + size_t count, loff_t *ppos)
> +{
> + return ima_show_htable_value(buf, count, ppos, &ima_htable.violations);
> +}


ima_htable.violations is an atomic_long_t and is not safe to pass
to ima_show_htable_value. Did you check for compilation warnings?

> +void ima_add_violation(struct inode *inode, const unsigned char *fname,
> + char *op, char *cause)
> +{
> + int result;
> +
> + /* can overflow, only indicator */
> + atomic_inc(&ima_htable.violations);

This also generates a warning. You probably want atomic_long_inc().


- James
--
James Morris
<jmorris@namei.org>


\
 
 \ /
  Last update: 2008-07-17 02:09    [W:0.072 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site