2010-01-24 16:04:14

by Thiago Farina

[permalink] [raw]
Subject: [PATCH 1/4] kernel/kfifo.c: fix "interger as NULL pointer" warning.

kernel/kfifo.c:83:35: warning: Using plain integer as NULL pointer

Signed-off-by: Thiago Farina <[email protected]>
---
kernel/kfifo.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/kfifo.c b/kernel/kfifo.c
index 32c5c15..6fe4a56 100644
--- a/kernel/kfifo.c
+++ b/kernel/kfifo.c
@@ -80,7 +80,7 @@ int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask)

buffer = kmalloc(size, gfp_mask);
if (!buffer) {
- _kfifo_init(fifo, 0, 0);
+ _kfifo_init(fifo, NULL, 0);
return -ENOMEM;
}

--
1.6.6.1.383.g5a9f


2010-01-24 16:06:13

by Thiago Farina

[permalink] [raw]
Subject: [PATCH 4/4] mm/memcontrol.c: fix "integer as NULL pointer" warning.

mm/memcontrol.c:2548:32: warning: Using plain integer as NULL pointer

Signed-off-by: Thiago Farina <[email protected]>
---
mm/memcontrol.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 954032b..d813823 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2545,7 +2545,7 @@ static int mem_cgroup_force_empty_list(struct mem_cgroup *mem,
pc = list_entry(list->prev, struct page_cgroup, lru);
if (busy == pc) {
list_move(&pc->lru, list);
- busy = 0;
+ busy = NULL;
spin_unlock_irqrestore(&zone->lru_lock, flags);
continue;
}
--
1.6.6.1.383.g5a9f

2010-01-24 16:11:30

by Thiago Farina

[permalink] [raw]
Subject: [PATCH 3/4] trace/trace_output.c: fix "integer as NULL pointer" warning.

kernel/trace/trace_output.c:256:24: warning: Using plain integer as NULL pointer

Signed-off-by: Thiago Farina <[email protected]>
---
kernel/trace/trace_output.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 8e46b33..2404c12 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -253,7 +253,7 @@ void *trace_seq_reserve(struct trace_seq *s, size_t len)
void *ret;

if (s->full)
- return 0;
+ return NULL;

if (len > ((PAGE_SIZE - 1) - s->len)) {
s->full = 1;
--
1.6.6.1.383.g5a9f

2010-01-24 16:11:45

by Thiago Farina

[permalink] [raw]
Subject: [PATCH 2/4] kernel/test_kprobes.c: fix "integer as NULL pointer" warning.

kernel/test_kprobes.c:118:19: warning: Using plain integer as NULL pointer
kernel/test_kprobes.c:213:22: warning: Using plain integer as NULL pointer
kernel/test_kprobes.c:326:22: warning: Using plain integer as NULL pointer

Signed-off-by: Thiago Farina <[email protected]>
---
kernel/test_kprobes.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/test_kprobes.c b/kernel/test_kprobes.c
index 4f10451..9a43351 100644
--- a/kernel/test_kprobes.c
+++ b/kernel/test_kprobes.c
@@ -115,7 +115,7 @@ static int test_kprobes(void)
int ret;
struct kprobe *kps[2] = {&kp, &kp2};

- kp.addr = 0; /* addr should be cleard for reusing kprobe. */
+ kp.addr = NULL; /* addr should be cleard for reusing kprobe. */
ret = register_kprobes(kps, 2);
if (ret < 0) {
printk(KERN_ERR "Kprobe smoke test failed: "
@@ -210,7 +210,7 @@ static int test_jprobes(void)
int ret;
struct jprobe *jps[2] = {&jp, &jp2};

- jp.kp.addr = 0; /* addr should be cleard for reusing kprobe. */
+ jp.kp.addr = NULL; /* addr should be cleard for reusing kprobe. */
ret = register_jprobes(jps, 2);
if (ret < 0) {
printk(KERN_ERR "Kprobe smoke test failed: "
@@ -323,7 +323,7 @@ static int test_kretprobes(void)
int ret;
struct kretprobe *rps[2] = {&rp, &rp2};

- rp.kp.addr = 0; /* addr should be cleard for reusing kprobe. */
+ rp.kp.addr = NULL; /* addr should be cleard for reusing kprobe. */
ret = register_kretprobes(rps, 2);
if (ret < 0) {
printk(KERN_ERR "Kprobe smoke test failed: "
--
1.6.6.1.383.g5a9f

2010-01-24 17:15:25

by Stefani Seibold

[permalink] [raw]
Subject: Re: [PATCH 1/4] kernel/kfifo.c: fix "interger as NULL pointer" warning.

Am Sonntag, den 24.01.2010, 11:03 -0500 schrieb Thiago Farina:
> kernel/kfifo.c:83:35: warning: Using plain integer as NULL pointer
>

I don't know where you get this kind of warning. But passing 0 for a
NULL pointer is ANSI C standard.

> Signed-off-by: Thiago Farina <[email protected]>
> ---
> kernel/kfifo.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/kfifo.c b/kernel/kfifo.c
> index 32c5c15..6fe4a56 100644
> --- a/kernel/kfifo.c
> +++ b/kernel/kfifo.c
> @@ -80,7 +80,7 @@ int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask)
>
> buffer = kmalloc(size, gfp_mask);
> if (!buffer) {
> - _kfifo_init(fifo, 0, 0);
> + _kfifo_init(fifo, NULL, 0);
> return -ENOMEM;
> }
>

2010-01-24 18:54:17

by Thiago Farina

[permalink] [raw]
Subject: Re: [PATCH 1/4] kernel/kfifo.c: fix "interger as NULL pointer" warning.

On Sun, Jan 24, 2010 at 3:15 PM, Stefani Seibold <[email protected]> wrote:
> Am Sonntag, den 24.01.2010, 11:03 -0500 schrieb Thiago Farina:
>> kernel/kfifo.c:83:35: warning: Using plain integer as NULL pointer
>>
>
> I don't know where you get this kind of warning. But passing 0 for a
> NULL pointer is ANSI C standard.

This is a sparse warning. Got with: make C=1.

2010-01-24 20:50:42

by Balbir Singh

[permalink] [raw]
Subject: Re: [PATCH 4/4] mm/memcontrol.c: fix "integer as NULL pointer" warning.

On Sunday 24 January 2010 09:33 PM, Thiago Farina wrote:
> mm/memcontrol.c:2548:32: warning: Using plain integer as NULL pointer

Looks good to me

Acked-by: Balbir Singh <[email protected]>

--
Three Cheers,
Balbir Singh

2010-01-25 10:11:42

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH 1/4] kernel/kfifo.c: fix "interger as NULL pointer" warning.

Stefani Seibold wrote:
> Am Sonntag, den 24.01.2010, 11:03 -0500 schrieb Thiago Farina:
>> kernel/kfifo.c:83:35: warning: Using plain integer as NULL pointer
>>
>
> I don't know where you get this kind of warning. But passing 0 for a
> NULL pointer is ANSI C standard.

It's not "Linus C", as implemented in sparse unfortunately.

-Andi

2010-01-25 21:40:36

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 3/4] trace/trace_output.c: fix "integer as NULL pointer" warning.

On Sun, 2010-01-24 at 11:03 -0500, Thiago Farina wrote:
> kernel/trace/trace_output.c:256:24: warning: Using plain integer as NULL pointer
>
> Signed-off-by: Thiago Farina <[email protected]>

Is this going through some other tree, or should I just pull it?

-- Steve

> ---
> kernel/trace/trace_output.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index 8e46b33..2404c12 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -253,7 +253,7 @@ void *trace_seq_reserve(struct trace_seq *s, size_t len)
> void *ret;
>
> if (s->full)
> - return 0;
> + return NULL;
>
> if (len > ((PAGE_SIZE - 1) - s->len)) {
> s->full = 1;

2010-01-27 01:39:19

by Thiago Farina

[permalink] [raw]
Subject: Re: [PATCH 1/4] kernel/kfifo.c: fix "interger as NULL pointer" warning.

Hi Stefani,

On Sun, Jan 24, 2010 at 3:15 PM, Stefani Seibold <[email protected]> wrote:
> Am Sonntag, den 24.01.2010, 11:03 -0500 schrieb Thiago Farina:
>> kernel/kfifo.c:83:35: warning: Using plain integer as NULL pointer
>>
>
> I don't know where you get this kind of warning. But passing 0 for a
> NULL pointer is ANSI C standard.

NACK?

2010-01-27 06:44:18

by Stefani Seibold

[permalink] [raw]
Subject: Re: [PATCH 1/4] kernel/kfifo.c: fix "interger as NULL pointer" warning.

Am Dienstag, den 26.01.2010, 23:39 -0200 schrieb Thiago Farina:
> Hi Stefani,
>
> On Sun, Jan 24, 2010 at 3:15 PM, Stefani Seibold <[email protected]> wrote:
> > Am Sonntag, den 24.01.2010, 11:03 -0500 schrieb Thiago Farina:
> >> kernel/kfifo.c:83:35: warning: Using plain integer as NULL pointer
> >>
> >
> > I don't know where you get this kind of warning. But passing 0 for a
> > NULL pointer is ANSI C standard.
>
> NACK?

Acked-by: Stefani Seibold <[email protected]>