gcc 4.3.0 prints this warning:
drivers/scsi/scsi_transport_iscsi.c: In function ‘iscsi_add_session’:
drivers/scsi/scsi_transport_iscsi.c:703: warning:\
 ‘err’ may be used uninitialized in this function

I'm not sure how exactly this can happen with
ISCSI_MAX_TARGET currently defined as -1.
But if ISCSI_MAX_TARGET would be defined as 0 and the function would
be called with target_id==0 we end up going to release_host without
setting err.

This patch sets err to -ENOENT for this path.

Signed-off-by: Benny Halevy <[EMAIL PROTECTED]>
 drivers/scsi/scsi_transport_iscsi.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c 
index 043c392..7d14228 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -706,6 +706,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, 
unsigned int target_id)
        session->sid = atomic_add_return(1, &iscsi_session_nr);
        if (id == ISCSI_MAX_TARGET) {
+               err = -ENOENT;
                for (id = 0; id < ISCSI_MAX_TARGET; id++) {
                        err = device_for_each_child(&shost->shost_gendev, &id,

You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi

Reply via email to