Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fix from James Bottomley:
"One small fix to SCSI Enclosure Services to fix a regression caused by
another recent fix"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: ses: Handle enclosure with just a primary component gracefully

+8 -12
+8 -12
drivers/scsi/ses.c
··· 509 509 int i; 510 510 struct ses_component *scomp; 511 511 512 - if (!edev->component[0].scratch) 513 - return 0; 514 - 515 512 for (i = 0; i < edev->components; i++) { 516 513 scomp = edev->component[i].scratch; 517 514 if (scomp->addr != efd->addr) ··· 599 602 components++, 600 603 type_ptr[0], 601 604 name); 602 - else 605 + else if (components < edev->components) 603 606 ecomp = &edev->component[components++]; 607 + else 608 + ecomp = ERR_PTR(-EINVAL); 604 609 605 610 if (!IS_ERR(ecomp)) { 606 611 if (addl_desc_ptr) { ··· 733 734 components += type_ptr[1]; 734 735 } 735 736 736 - if (components == 0) { 737 - sdev_printk(KERN_WARNING, sdev, "enclosure has no enumerated components\n"); 738 - goto err_free; 739 - } 740 - 741 737 ses_dev->page1 = buf; 742 738 ses_dev->page1_len = len; 743 739 buf = NULL; ··· 774 780 buf = NULL; 775 781 } 776 782 page2_not_supported: 777 - scomp = kcalloc(components, sizeof(struct ses_component), GFP_KERNEL); 778 - if (!scomp) 779 - goto err_free; 783 + if (components > 0) { 784 + scomp = kcalloc(components, sizeof(struct ses_component), GFP_KERNEL); 785 + if (!scomp) 786 + goto err_free; 787 + } 780 788 781 789 edev = enclosure_register(cdev->parent, dev_name(&sdev->sdev_gendev), 782 790 components, &ses_enclosure_callbacks);