Print this page
NEX-13218 Segfault in sun_fc library
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>


 806                     mappings->entries[i].targetNumber;
 807             userMappings->entry[i].ScsiId.ScsiOSLun =
 808                     mappings->entries[i].osLUN;
 809             userMappings->entry[i].FcpId.FcId =
 810                     mappings->entries[i].d_id;
 811             memcpy(userMappings->entry[i].FcpId.NodeWWN.wwn,
 812                     mappings->entries[i].NodeWWN.raw_wwn,
 813                     sizeof (la_wwn_t));
 814             memcpy(userMappings->entry[i].FcpId.PortWWN.wwn,
 815                     mappings->entries[i].PortWWN.raw_wwn,
 816                     sizeof (la_wwn_t));
 817 
 818             userMappings->entry[i].FcpId.FcpLun = 
 819                 mappings->entries[i].samLUN;
 820                 
 821             memcpy(userMappings->entry[i].LUID.buffer,
 822                     mappings->entries[i].guid,
 823                     sizeof (userMappings->entry[i].LUID.buffer));
 824         }
 825 



 826         log.debug("Total mappings: %d %08x %08x",
 827             mappings->numLuns, mappings->entries[i].osLUN, mappings->entries[i].samLUN);
 828 
 829         // If everything is good, convert paths to sym-links
 830         if (mappings->numLuns > 0 && !zeroLength) {
 831             if (userMappings->NumberOfEntries >= mappings->numLuns) {
 832                 // User buffer is larger than needed. (All is good)
 833                 userMappings->NumberOfEntries = mappings->numLuns;
 834                 convertToShortNames(userMappings);
 835             } else {
 836                 // User buffer is non zero, but too small.  Don't bother with links
 837                 userMappings->NumberOfEntries = mappings->numLuns;
 838                 delete (mappings);
 839                 throw MoreDataException();
 840             }
 841         } else if (mappings->numLuns > 0) {
 842             // Zero length buffer, but we've got mappings
 843             userMappings->NumberOfEntries = mappings->numLuns;
 844             delete (mappings);
 845             throw MoreDataException();




 806                     mappings->entries[i].targetNumber;
 807             userMappings->entry[i].ScsiId.ScsiOSLun =
 808                     mappings->entries[i].osLUN;
 809             userMappings->entry[i].FcpId.FcId =
 810                     mappings->entries[i].d_id;
 811             memcpy(userMappings->entry[i].FcpId.NodeWWN.wwn,
 812                     mappings->entries[i].NodeWWN.raw_wwn,
 813                     sizeof (la_wwn_t));
 814             memcpy(userMappings->entry[i].FcpId.PortWWN.wwn,
 815                     mappings->entries[i].PortWWN.raw_wwn,
 816                     sizeof (la_wwn_t));
 817 
 818             userMappings->entry[i].FcpId.FcpLun = 
 819                 mappings->entries[i].samLUN;
 820                 
 821             memcpy(userMappings->entry[i].LUID.buffer,
 822                     mappings->entries[i].guid,
 823                     sizeof (userMappings->entry[i].LUID.buffer));
 824         }
 825 
 826         if (!zeroLength) {
 827             i -= 1;
 828         }
 829         log.debug("Total mappings: %d %08x %08x",
 830             mappings->numLuns, mappings->entries[i].osLUN, mappings->entries[i].samLUN);
 831 
 832         // If everything is good, convert paths to sym-links
 833         if (mappings->numLuns > 0 && !zeroLength) {
 834             if (userMappings->NumberOfEntries >= mappings->numLuns) {
 835                 // User buffer is larger than needed. (All is good)
 836                 userMappings->NumberOfEntries = mappings->numLuns;
 837                 convertToShortNames(userMappings);
 838             } else {
 839                 // User buffer is non zero, but too small.  Don't bother with links
 840                 userMappings->NumberOfEntries = mappings->numLuns;
 841                 delete (mappings);
 842                 throw MoreDataException();
 843             }
 844         } else if (mappings->numLuns > 0) {
 845             // Zero length buffer, but we've got mappings
 846             userMappings->NumberOfEntries = mappings->numLuns;
 847             delete (mappings);
 848             throw MoreDataException();