[ofw] [PATCH] SRP: fix S/G length for direct data buffer descriptor format

Arne Redlich arne.redlich at xiranet.com
Fri Mar 7 08:16:41 PST 2008


If a target announces support for the direct data buffer descriptor
format only, the number of scatter/gather entries should be set to 1.

Signed-off-by: Arne Redlich <arne.redlich at xiranet.com>
---
Found while reading through the code and not tested at all.

And while we're at it: I haven't found any sanity checks of the I_T IU
size nearby, IOW code that makes sure it is large enough to hold at
least 1 descriptor so the number of S/G entries is at least 1. But maybe
I just haven't looked hard enough?

Cheers,
Arne

Index: kernel/srp_connection.c
===================================================================
--- kernel/srp_connection.c	(revision 982)
+++ kernel/srp_connection.c	(working copy)
@@ -467,8 +467,8 @@ __srp_cm_reply_cb(
 	}
 	else if (( p_connection->descriptor_format & DBDF_DIRECT_DATA_BUFFER_DESCRIPTOR ) == DBDF_DIRECT_DATA_BUFFER_DESCRIPTOR )
 	{
-		p_connection->max_scatter_gather_entries = 
-				(p_connection->init_to_targ_iu_sz - offsetof( srp_cmd_t, additional_cdb ))/ sizeof( srp_memory_descriptor_t );
+		p_connection->max_scatter_gather_entries =
+			((p_connection->init_to_targ_iu_sz - offsetof( srp_cmd_t, additional_cdb )) / sizeof( srp_memory_descriptor_t )) ? 1 : 0;
 	}
 	else /*	not reported any descriptor format */
 	{



More information about the ofw mailing list