Commit 68eda8f59081c74a51d037cc29893bd7c9b3c2d8
Committed by
James Morris
1 parent
f6f94e2ab1
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: Dan Carpenter <error27@gmail.com> Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
security/tomoyo/common.c
... | ... | @@ -768,8 +768,10 @@ |
768 | 768 | return true; /* Do nothing if open(O_WRONLY). */ |
769 | 769 | memset(&head->r, 0, sizeof(head->r)); |
770 | 770 | head->r.print_this_domain_only = true; |
771 | - head->r.eof = !domain; | |
772 | - head->r.domain = &domain->list; | |
771 | + if (domain) | |
772 | + head->r.domain = &domain->list; | |
773 | + else | |
774 | + head->r.eof = 1; | |
773 | 775 | tomoyo_io_printf(head, "# select %s\n", data); |
774 | 776 | if (domain && domain->is_deleted) |
775 | 777 | tomoyo_io_printf(head, "# This is a deleted domain.\n"); |