All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [patch 1/1] kernel/resource.c: __request_region argument check
@ 2006-06-27  7:22 Brian Jung Myeng Lee
  2006-06-27  8:04 ` [KJ] [patch 1/1] kernel/resource.c: __request_region argument Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Brian Jung Myeng Lee @ 2006-06-27  7:22 UTC (permalink / raw)
  To: kernel-janitors

Add argument check for parameters n and name.

Signed-off-by: Brian Jung Myeng Lee <jm3lee@gmail.com>

---

--- linux-2.6.17-rc6/kernel/resource.c	2006-06-05 20:57:02.000000000 -0400
+++ linux-2.6.17-rc6-modified/kernel/resource.c	2006-06-27
03:06:41.000000000 -0400
@@ -430,7 +430,12 @@
  */
 struct resource * __request_region(struct resource *parent, unsigned
long start, unsigned long n, const char *name)
 {
-	struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
+	struct resource *res = NULL;
+
+	if (n = 0 || name = NULL)
+		return NULL;
+
+	res = kzalloc(sizeof(struct resource), GFP_KERNEL);

 	if (res) {
 		res->name = name;

---

This is my attempt at starting with Kernel Janitor's TODO list. I am
not so sure if I should be checking if parent = NULL. I think the
code runs just fine even if parent = NULL.

-- 
Brian Jung Myeng Lee
Homepage: http://koreanbrian.com
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [patch 1/1] kernel/resource.c: __request_region argument
  2006-06-27  7:22 [KJ] [patch 1/1] kernel/resource.c: __request_region argument check Brian Jung Myeng Lee
@ 2006-06-27  8:04 ` Greg KH
  2006-06-27  8:29 ` Brian Jung Myeng Lee
  2006-06-27 23:16 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2006-06-27  8:04 UTC (permalink / raw)
  To: kernel-janitors

On Tue, Jun 27, 2006 at 03:22:05AM -0400, Brian Jung Myeng Lee wrote:
> Add argument check for parameters n and name.

Why?  What is that helping out with?  This might break some
already-running code...

thanks,

greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [patch 1/1] kernel/resource.c: __request_region argument
  2006-06-27  7:22 [KJ] [patch 1/1] kernel/resource.c: __request_region argument check Brian Jung Myeng Lee
  2006-06-27  8:04 ` [KJ] [patch 1/1] kernel/resource.c: __request_region argument Greg KH
@ 2006-06-27  8:29 ` Brian Jung Myeng Lee
  2006-06-27 23:16 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Brian Jung Myeng Lee @ 2006-06-27  8:29 UTC (permalink / raw)
  To: kernel-janitors

Oops, I'm sorry. I guess it's a little bit getting too late.

Here's a copy of my response.

Greg,

I must have misinterpreted what it said on the TODO list. Under Audit
section, request_region() is listed. (I found that request_region() is
a macro that really calls __request_region().) I thought somebody
wanted to check and see if __request_region() returns proper return
values. I noticed that

               res->end = start + n - 1;

in kernel/resource.c:__request_region(). If n = 0, I think res->end <
res->start, which I hope is not the valid region.

Thank you for the feedback.

On 6/27/06, Greg KH <greg@kroah.com> wrote:
> On Tue, Jun 27, 2006 at 04:13:45AM -0400, Brian Jung Myeng Lee wrote:
> > Greg,
>
> Hm, any reason you sent this just to me?  Try responding to the whole
> list please, as it's a bit rude to take conversations off-list for no
> reason.
>
> thanks,
>
> greg k-h
>


-- 
Brian Jung Myeng Lee
Homepage: http://koreanbrian.com
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [patch 1/1] kernel/resource.c: __request_region argument
  2006-06-27  7:22 [KJ] [patch 1/1] kernel/resource.c: __request_region argument check Brian Jung Myeng Lee
  2006-06-27  8:04 ` [KJ] [patch 1/1] kernel/resource.c: __request_region argument Greg KH
  2006-06-27  8:29 ` Brian Jung Myeng Lee
@ 2006-06-27 23:16 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2006-06-27 23:16 UTC (permalink / raw)
  To: kernel-janitors

On Tue, Jun 27, 2006 at 04:29:20AM -0400, Brian Jung Myeng Lee wrote:
> Oops, I'm sorry. I guess it's a little bit getting too late.
> 
> Here's a copy of my response.
> 
> Greg,
> 
> I must have misinterpreted what it said on the TODO list. Under Audit
> section, request_region() is listed. (I found that request_region() is
> a macro that really calls __request_region().) I thought somebody
> wanted to check and see if __request_region() returns proper return
> values. I noticed that
> 
>                res->end = start + n - 1;
> 
> in kernel/resource.c:__request_region(). If n = 0, I think res->end <
> res->start, which I hope is not the valid region.

Sorry, but no, the issue is to audit all _users_ of the request_region()
call to make sure they properly handle the fact when the call fails.

thanks,

greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2006-06-27 23:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-27  7:22 [KJ] [patch 1/1] kernel/resource.c: __request_region argument check Brian Jung Myeng Lee
2006-06-27  8:04 ` [KJ] [patch 1/1] kernel/resource.c: __request_region argument Greg KH
2006-06-27  8:29 ` Brian Jung Myeng Lee
2006-06-27 23:16 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.