public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Problems in list.h macros?
@ 2004-10-06 21:31 Stuart MacDonald
  2004-10-06 22:38 ` Possible Spam:Re: " Peter W. Morreale
  0 siblings, 1 reply; 2+ messages in thread
From: Stuart MacDonald @ 2004-10-06 21:31 UTC (permalink / raw)
  To: 'Linux Kernel Mailing List'

I am referring to a stock 2.4.27's linux/list.h.

1: list_for_each(_entry)_safe() calls seem not to be as safe as they
are implied to be. They seem to be only actually safe *iff* a
list_del() is the only operation performed on the list entry. If pos
is freed after a list_del, aren't you toast? If n has its pointers
modified, say by a list_add() to a different list, don't you end up
at the new list instead of the original list? Shouldn't this be noted
in the macro comments?

..Stu


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

* Possible Spam:Re: Problems in list.h macros?
  2004-10-06 21:31 Problems in list.h macros? Stuart MacDonald
@ 2004-10-06 22:38 ` Peter W. Morreale
  0 siblings, 0 replies; 2+ messages in thread
From: Peter W. Morreale @ 2004-10-06 22:38 UTC (permalink / raw)
  To: Stuart MacDonald; +Cc: 'Linux Kernel Mailing List'

 From list.h:

 * list_for_each_safe   -       iterate over a list safe against removal 
of list entry

It's only safe to remove entries.    

-PWM



Stuart MacDonald wrote:

>I am referring to a stock 2.4.27's linux/list.h.
>
>1: list_for_each(_entry)_safe() calls seem not to be as safe as they
>are implied to be. They seem to be only actually safe *iff* a
>list_del() is the only operation performed on the list entry. If pos
>is freed after a list_del, aren't you toast? If n has its pointers
>modified, say by a list_add() to a different list, don't you end up
>at the new list instead of the original list? Shouldn't this be noted
>in the macro comments?
>
>..Stu
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>
>  
>




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

end of thread, other threads:[~2004-10-06 22:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-06 21:31 Problems in list.h macros? Stuart MacDonald
2004-10-06 22:38 ` Possible Spam:Re: " Peter W. Morreale

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