Commit cdbbbe19 authored by Mimi Zohar's avatar Mimi Zohar Committed by Sasha Levin

ima: fix ima_show_template_data_ascii()

[ Upstream commit 45b26133 ]

This patch fixes a bug introduced in "4d7aeee ima: define new template
ima-ng and template fields d-ng and n-ng".

Changelog:
- change int to uint32 (Roberto Sassu's suggestion)
Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: default avatarRoberto Sassu <rsassu@suse.de>
Cc: stable@vger.kernel.org # 3.13
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent c00a6861
...@@ -106,7 +106,7 @@ void ima_add_violation(struct file *file, const unsigned char *filename, ...@@ -106,7 +106,7 @@ void ima_add_violation(struct file *file, const unsigned char *filename,
const char *op, const char *cause); const char *op, const char *cause);
int ima_init_crypto(void); int ima_init_crypto(void);
void ima_putc(struct seq_file *m, void *data, int datalen); void ima_putc(struct seq_file *m, void *data, int datalen);
void ima_print_digest(struct seq_file *m, u8 *digest, int size); void ima_print_digest(struct seq_file *m, u8 *digest, u32 size);
struct ima_template_desc *ima_template_desc_current(void); struct ima_template_desc *ima_template_desc_current(void);
int ima_init_template(void); int ima_init_template(void);
......
...@@ -186,9 +186,9 @@ static const struct file_operations ima_measurements_ops = { ...@@ -186,9 +186,9 @@ static const struct file_operations ima_measurements_ops = {
.release = seq_release, .release = seq_release,
}; };
void ima_print_digest(struct seq_file *m, u8 *digest, int size) void ima_print_digest(struct seq_file *m, u8 *digest, u32 size)
{ {
int i; u32 i;
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
seq_printf(m, "%02x", *(digest + i)); seq_printf(m, "%02x", *(digest + i));
......
...@@ -70,7 +70,8 @@ static void ima_show_template_data_ascii(struct seq_file *m, ...@@ -70,7 +70,8 @@ static void ima_show_template_data_ascii(struct seq_file *m,
enum data_formats datafmt, enum data_formats datafmt,
struct ima_field_data *field_data) struct ima_field_data *field_data)
{ {
u8 *buf_ptr = field_data->data, buflen = field_data->len; u8 *buf_ptr = field_data->data;
u32 buflen = field_data->len;
switch (datafmt) { switch (datafmt) {
case DATA_FMT_DIGEST_WITH_ALGO: case DATA_FMT_DIGEST_WITH_ALGO:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment