From patchwork Sat Apr 15 14:42:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Bottomley X-Patchwork-Id: 83733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1079558vqo; Sat, 15 Apr 2023 07:46:39 -0700 (PDT) X-Google-Smtp-Source: AKy350YrhgVP5xnZsocrSuANZXO/ChJ0tV9EOZGN3AWqp6npu1YPIxQwuyYnCc0ySD09ByxcOqK0 X-Received: by 2002:a17:902:ec84:b0:1a6:6bd4:cd8c with SMTP id x4-20020a170902ec8400b001a66bd4cd8cmr6993796plg.25.1681569999005; Sat, 15 Apr 2023 07:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681569998; cv=none; d=google.com; s=arc-20160816; b=qTdvFMjUxDk5kb3rckKcL2MU+8ebV1K0qLdB1vvobq+MNKg1pFogzvgjN/yEMhfTBj We4CcRhxb9wr635OkFYrM45cZ8GPY5KMiTPXb0X5OGeWw4RkxV643sr2BRurQGNWu101 kEhaMo7lfnvCLjG3A372koymHvDo+uyX6XS9AOsTCi78NIlamwZnMkJdi1y/Y+ONZ8b+ 5PT8CjKsGhTVm6iLWHJEW1pEjs6BLmWRWnPeGULiEmDC2YAGFDtAnH6ayrkPMCV1Z/Yq 5GzStjK2rT2hq7ffAdHNOWI9V7UVMHk6Bw++eBMzQYKK/c32gVLIOBFijHsMHtli56pt fxlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:date:cc:to:from:subject:message-id:dkim-signature :dkim-signature; bh=/tMWjhRYfTxKWiH2r3stuezVISL/VGmpYc39WPxvpms=; b=DanLmPw3wVAnSzKtfAkWqVxF+jTQqegQuKRZFzM42CpFegbnejlJpePi672xWkS8dj tw/WDW41cexuKwJVtDJfp2SawkLGCCXRP7w7tbvcmVV9/vnnGtYZaIQeg0+ALLwqsoTV SPgaRjZYhVSW6RWD9p+oAXFKs5lLtZExIqCGCZgP+u5JS40VaCrAPEHNPnFOmwXyOgL7 C3YIJ180CymwffqtR6eWOhuXetUtqy8e98WRoqWoe504oO4urc7rgKWIae0Gr7Vgw6go yF1TRQV9Ndl/+Jq84e9M4OsI+t6XymdC543EO4Ave6GJn+SzNafPT+YDP3GDBZCFx6cZ 93rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=I1HO4cW4; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=I1HO4cW4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay10-20020a1709028b8a00b001a05347d092si6778872plb.642.2023.04.15.07.46.23; Sat, 15 Apr 2023 07:46:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=I1HO4cW4; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=I1HO4cW4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbjDOOm5 (ORCPT + 99 others); Sat, 15 Apr 2023 10:42:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbjDOOm4 (ORCPT ); Sat, 15 Apr 2023 10:42:56 -0400 Received: from bedivere.hansenpartnership.com (bedivere.hansenpartnership.com [IPv6:2607:fcd0:100:8a00::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B462D56; Sat, 15 Apr 2023 07:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1681569765; bh=JnyT8+dt75oOzt5U0jdm6k2Z5jJt9+vYzsqgY6mtjOA=; h=Message-ID:Subject:From:To:Date:From; b=I1HO4cW41wg5Pp0TMy2M5N74aVUpJivGXHPwcSAV+1mnlm97zgmKcdTu7aY75BXIH qsNNXoFt1jow1d+dtVzrtQqj1zBaw9Cfi/cE5ItQCiI61soz6sxuE4eUjelO8jRtE2 MgtBb+r4jFPeSTk6E17aqY0CqK8gNZWPvoAZEvh0= Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id E73191281076; Sat, 15 Apr 2023 10:42:45 -0400 (EDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavis, port 10024) with ESMTP id lOMc3HZQ3Sxy; Sat, 15 Apr 2023 10:42:45 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1681569765; bh=JnyT8+dt75oOzt5U0jdm6k2Z5jJt9+vYzsqgY6mtjOA=; h=Message-ID:Subject:From:To:Date:From; b=I1HO4cW41wg5Pp0TMy2M5N74aVUpJivGXHPwcSAV+1mnlm97zgmKcdTu7aY75BXIH qsNNXoFt1jow1d+dtVzrtQqj1zBaw9Cfi/cE5ItQCiI61soz6sxuE4eUjelO8jRtE2 MgtBb+r4jFPeSTk6E17aqY0CqK8gNZWPvoAZEvh0= Received: from [IPv6:2601:5c4:4302:c21::a774] (unknown [IPv6:2601:5c4:4302:c21::a774]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 413041280DCB; Sat, 15 Apr 2023 10:42:45 -0400 (EDT) Message-ID: Subject: [GIT PULL] SCSI fixes for 6.3-rc6 From: James Bottomley To: Andrew Morton , Linus Torvalds Cc: linux-scsi , linux-kernel Date: Sat, 15 Apr 2023 10:42:43 -0400 User-Agent: Evolution 3.42.4 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763253943578602846?= X-GMAIL-MSGID: =?utf-8?q?1763253943578602846?= One small fix to SCSI Enclosure Services to fix a regression caused by another recent fix. The patch is available here: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes The short changelog is: Jiri Kosina (1): scsi: ses: Handle enclosure with just a primary component gracefully And the diffstat: drivers/scsi/ses.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) With full diff below. James diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index b11a9162e73a..b54f2c6c08c3 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -509,9 +509,6 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev, int i; struct ses_component *scomp; - if (!edev->component[0].scratch) - return 0; - for (i = 0; i < edev->components; i++) { scomp = edev->component[i].scratch; if (scomp->addr != efd->addr) @@ -602,8 +599,10 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, components++, type_ptr[0], name); - else + else if (components < edev->components) ecomp = &edev->component[components++]; + else + ecomp = ERR_PTR(-EINVAL); if (!IS_ERR(ecomp)) { if (addl_desc_ptr) { @@ -734,11 +733,6 @@ static int ses_intf_add(struct device *cdev, components += type_ptr[1]; } - if (components == 0) { - sdev_printk(KERN_WARNING, sdev, "enclosure has no enumerated components\n"); - goto err_free; - } - ses_dev->page1 = buf; ses_dev->page1_len = len; buf = NULL; @@ -780,9 +774,11 @@ static int ses_intf_add(struct device *cdev, buf = NULL; } page2_not_supported: - scomp = kcalloc(components, sizeof(struct ses_component), GFP_KERNEL); - if (!scomp) - goto err_free; + if (components > 0) { + scomp = kcalloc(components, sizeof(struct ses_component), GFP_KERNEL); + if (!scomp) + goto err_free; + } edev = enclosure_register(cdev->parent, dev_name(&sdev->sdev_gendev), components, &ses_enclosure_callbacks);