Void casting: my compiler gave me a warning, and I don't like that.
pid=-1, leftover from error checking that i didn't need, my fault.
pid=0, find_task_by_pid(0) will return a valid pointer, but it doesn't seem to really be a good task. This seems to be related to the kernel idle task. If you pass 0, it will seg fault w\o the check. I'm not sure what a signed off-by does, but long as i can get bb to agree with this.... i'm okay with it. :)
Allan


Jeff Dike wrote:

On Wed, Aug 31, 2005 at 07:06:33PM -0400, Allan Graves wrote:
Jeff,
Here's the patches.  Hope these meet your approval!
Allan

Some comments - I have these all fixed:

        +        struct task_struct *from=(struct task_struct*)prev;
        +        struct task_struct *to=(struct task_struct*)next;
There's no need to cast when the source is a void *

        +          CHOOSE_MODE(switch_to_tt(prev, next),
        +             switch_to_skas(prev, next));
There's a CHOOSE_MODE_PROC which lets you avoid repeating common argument
lists, although I was doing this wrong here too.

        +extern int switch_to_skas(void *prev, void *next);
        +extern int switch_to_tt(void *prev, void *next);
Since these can't do anything but return 0, they might as well be void

        +        if (0==sscanf(ptr, "%d", &pid_requested) || pid_requested==-1) 
{
The pid_requested==-1 is redundant - if sscanf failed, we just want to bail out

        +        if((!to) || (pid_requested == 0)) {
Why the check against 0?

        +               next=(void *)current->thread.saved_task;
        +               prev=(void*)current;
No need to cast when the target is a void * either

Also, OK for me to add a Signed-off-by: you?

                                Jeff


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to