public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] tomoyo: cleanup.  don't store bogus pointer
@ 2010-08-07 22:17 Dan Carpenter
  2010-08-10  6:56 ` Tetsuo Handa
  2010-08-15 23:19 ` James Morris
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-08-07 22:17 UTC (permalink / raw)
  To: kernel-janitors

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>

diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index ef43995..a4dc2d5 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -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");

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-15 23:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-07 22:17 [patch] tomoyo: cleanup. don't store bogus pointer Dan Carpenter
2010-08-10  6:56 ` Tetsuo Handa
2010-08-15 23:19 ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox