Skip to content

Commit

Permalink
tomoyo: cleanup. don't store bogus pointer
Browse files Browse the repository at this point in the history
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: Dan Carpenter <error27@gmail.com>
Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
  • Loading branch information
error27 authored and James Morris committed Oct 20, 2010
1 parent f6f94e2 commit 68eda8f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions security/tomoyo/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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). */
memset(&head->r, 0, sizeof(head->r));
head->r.print_this_domain_only = true;
head->r.eof = !domain;
head->r.domain = &domain->list;
if (domain)
head->r.domain = &domain->list;
else
head->r.eof = 1;
tomoyo_io_printf(head, "# select %s\n", data);
if (domain && domain->is_deleted)
tomoyo_io_printf(head, "# This is a deleted domain.\n");
Expand Down

0 comments on commit 68eda8f

Please sign in to comment.