Commit 68eda8f5 authored by Dan Carpenter's avatar Dan Carpenter Committed by James Morris

tomoyo: cleanup. don't store bogus pointer

If domain is NULL then &domain->list is a bogus address.  Let's leave
head->r.domain NULL instead of saving an unusable pointer.

This is just a cleanup.  The current code always checks head->r.eof
before dereferencing head->r.domain.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
parent f6f94e2a
...@@ -768,8 +768,10 @@ static bool tomoyo_select_one(struct tomoyo_io_buffer *head, const char *data) ...@@ -768,8 +768,10 @@ static bool tomoyo_select_one(struct tomoyo_io_buffer *head, const char *data)
return true; /* Do nothing if open(O_WRONLY). */ return true; /* Do nothing if open(O_WRONLY). */
memset(&head->r, 0, sizeof(head->r)); memset(&head->r, 0, sizeof(head->r));
head->r.print_this_domain_only = true; head->r.print_this_domain_only = true;
head->r.eof = !domain; if (domain)
head->r.domain = &domain->list; head->r.domain = &domain->list;
else
head->r.eof = 1;
tomoyo_io_printf(head, "# select %s\n", data); tomoyo_io_printf(head, "# select %s\n", data);
if (domain && domain->is_deleted) if (domain && domain->is_deleted)
tomoyo_io_printf(head, "# This is a deleted domain.\n"); tomoyo_io_printf(head, "# This is a deleted domain.\n");
......
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