[PATCH 3/4] Fix list entry retrieval

View: New views
1 Messages — Rating Filter:   Alert me  

[PATCH 3/4] Fix list entry retrieval

by Arne Redlich-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When overwriting an outgoing account, the retrieval of the old account relies
on the order of struct user's members. Use list_entry() instead.
---
 usr/plain.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/usr/plain.c b/usr/plain.c
index b9fee41..386dadf 100644
--- a/usr/plain.c
+++ b/usr/plain.c
@@ -220,7 +220,7 @@ static int plain_account_add(u32 tid, int dir, char *name, char *pass)
     " Replacing the old one.\n",
     tid ? "target" : "discovery");
 
- old = (struct user *) list->q_forw;
+ old = list_entry(list->q_forw, struct user, ulist);
  account_destroy(old);
  }
 
--
1.5.4.3


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Iscsitarget-devel mailing list
Iscsitarget-devel@...
https://lists.sourceforge.net/lists/listinfo/iscsitarget-devel
LightInTheBox - Buy quality products at wholesale price