Skip to contentSkip to conversation

KernelJanitor: Convert remaining error returns to return -E Linux 2.5.68

PATCH In review Gabriel Devenyi 6 participants 9 messages Apr 29, 2003 – May 5, 2003

lore
Share & tools
lore
#1 lore raw

On Tue, 29 Apr 2003 22:15:20 +0000 Gabriel Devenyi <[email protected]> wrote:

| This patch applies to 2.5.68. It converts all the remaining error returns to 
| the new return -E form, this is in the KernelJanitor TODO list.
| 
| http://muss.mcmaster.ca/~devenyga/patch-linux-2.5.68-return-errors.patch
| 
| Please CC me with any discussion since I do not subscribe to lkml
| -- 

I'd have to say that it really depends on whether the caller can handle negative return values. Did you check/audit the callers too?

If it's a well-defined Unix/Linux error code (like s/ENOMEM/-ENOMEM/), this should be made to work (at least in most cases).

And don't change ones that use ERR_PTR, like this:

- return ERR_PTR(-ENOMEM);
+ return -ENOMEM;

Local variable returns of positive/negative are probably not correct... without auditing the callers, it's hard to say. E.g.:

- return ErrFlag;
+ return -ErrFlag;

(same type of change in DAC960 driver)

I'm a bit suspicious of:

- return EOF;
+ return -EOF;

and

- return E05;
+ return -E05;

It's not just a global search & replace...

One more thing... did you build and boot that modified kernel? If so, did it build with the same number or fewer warnings than the unmodified version?

--
~Randy

#2 lore raw

Thanks for the suggestions, I'm kinda new at this and just following the TODO which unfortuately says "sed s/return EWHATEVER/return -EWHATEVER/". I'll work on checking the things you suggested. As for your other questions, the kernel did build but I didn't attempt to boot it, I'll be sure to do so in the future. Thanks for the encouragement.

P.S. Anyone who works on KernelJanitor, kj.pl is suggesting some of the things I'm changing which aparently I shouldn't.

Building the Future,
Gabriel Devenyi
[email protected]

Quoted 1 line · you

On Tue, 29 Apr 2003 22:15:20 +0000 Gabriel Devenyi <[email protected]>

Quoted 48 lines · wrote:
| This patch applies to 2.5.68. It converts all the remaining error returns
| to the new return -E form, this is in the KernelJanitor TODO list.
|
| http://muss.mcmaster.ca/~devenyga/patch-linux-2.5.68-return-errors.patch
|
| Please CC me with any discussion since I do not subscribe to lkml
| --

I'd have to say that it really depends on whether the caller can handle negative return values. Did you check/audit the callers too?

If it's a well-defined Unix/Linux error code (like s/ENOMEM/-ENOMEM/), this should be made to work (at least in most cases).

And don't change ones that use ERR_PTR, like this:

(quoted diff) +1 -1
-		return ERR_PTR(-ENOMEM);
+		return -ENOMEM;

Local variable returns of positive/negative are probably not correct... without auditing the callers, it's hard to say. E.g.:

(quoted diff) +1 -1
-	return ErrFlag;
+	return -ErrFlag;

(same type of change in DAC960 driver)

I'm a bit suspicious of:

(quoted diff) +1 -1
-	return EOF;
+	return -EOF;

and

(quoted diff) +1 -1
-		return E05;
+		return -E05;

It's not just a global search & replace...

One more thing... did you build and boot that modified kernel? If so, did it build with the same number or fewer warnings than the unmodified version?

--
~Randy

#3 lore raw
Quoted 2 lines · Gabriel Devenyi

P.S. Anyone who works on KernelJanitor, kj.pl is suggesting some of the things I'm changing which aparently I shouldn't.

I'd take most things it says with a pinch of salt.
I wasn't kidding when I said I knew no perl at all before I wrote this. I stopped hacking on it when Dan Carpenters smatch appeared, as it was a more 'real' solution with a future.

kj.pl was a fun weekend hack.

Dave

#4 lore raw
In reply to Gabriel Devenyi
Quoted 6 lines · Gabriel Devenyi

This patch applies to 2.5.68. It converts all the remaining error returns to the new return -E form, this is in the KernelJanitor TODO list.

http://muss.mcmaster.ca/~devenyga/patch-linux-2.5.68-return-errors.patch

Please CC me with any discussion since I do not subscribe to lkml

Have you tried to compile the patched kernel?

Patch is bogus - most of the changes are s/return ERR_PTR(foo)/return foo/ with neither explanation nor change of function prototype not change of other exits from these functions.

WTF was it intended to do?

#5 lore raw

It was intended to do exactly what the KernelJanitor TODO and kj.pl script pointed out, but aparently there's more to it than that. (BTW it just says "sed s/return EWHATEVER/return -EWHATEVER/") Discouraging people with foul language isn't the best way to get more developers, this is only my first try.

Signature · 3 lines
Building the Future,
Gabriel Devenyi
[email protected]
Quoted 15 lines · you
Quoted 6 lines · Gabriel Devenyi

This patch applies to 2.5.68. It converts all the remaining error returns to the new return -E form, this is in the KernelJanitor TODO list.

http://muss.mcmaster.ca/~devenyga/patch-linux-2.5.68-return-errors.patch

Please CC me with any discussion since I do not subscribe to lkml

Have you tried to compile the patched kernel?

Patch is bogus - most of the changes are s/return ERR_PTR(foo)/return foo/ with neither explanation nor change of function prototype not change of other exits from these functions.

WTF was it intended to do?

Signature · 3 lines
Building the Future,
Gabriel Devenyi
[email protected]
#6 lore raw

Hi!

Quoted 5 lines

It was intended to do exactly what the KernelJanitor TODO and kj.pl script pointed out, but aparently there's more to it than that. (BTW it just says "sed s/return EWHATEVER/return -EWHATEVER/") Discouraging people with foul language isn't the best way to get more developers, this is only my first try.

That's Al Viro, it seems. He is hidding his real name? He's always like that, and his flames are actually pretty nice reading. [And if you did not even try to compile/boot that kernel, you deserve them.]

Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#7 lore raw
Quoted 10 lines · Pavel Machek

Hi!

Quoted 5 lines

It was intended to do exactly what the KernelJanitor TODO and kj.pl script pointed out, but aparently there's more to it than that. (BTW it just says "sed s/return EWHATEVER/return -EWHATEVER/") Discouraging people with foul language isn't the best way to get more developers, this is only my first try.

That's Al Viro, it seems. He is hidding his real name? He's always like that

???

When the fsck had I ever stooped down to hiding my name?

#8 lore raw
Quoted 1 line

When the fsck had I ever stooped down to hiding my name?

I guess Pavel means that From: in your latest submissions lacks the full name.

Have a nice fortnight

Signature · 3 lines
Martin `MJ' Mares   <[email protected]>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
Current root password is "p3s5vwF50". Keep secret.