Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1890373rwe; Sat, 15 Apr 2023 07:47:08 -0700 (PDT) X-Google-Smtp-Source: AKy350YYVWhBf4N5+Xlr7y9/YQ2d+M1hEPaH7ATdXwrN+q1vWuMgAdOkQXCswJRDo7SjqZiWDXzL X-Received: by 2002:a17:902:e748:b0:1a6:7570:5368 with SMTP id p8-20020a170902e74800b001a675705368mr7067778plf.19.1681570028576; Sat, 15 Apr 2023 07:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681570028; cv=none; d=google.com; s=arc-20160816; b=kLzVPgPM99GcuarUz2SR86X/QnLN62Rhw9Z5cs6CrF+fMCi5KGnX4kz/C6Xh2TXdSn zVteVK8CpWBqodR9EZUPm+OhurfTJQsg6yY/HfEdo2YB19XRPCJZ9svkbOIAm1zesLoP 62LOyiWIbRVQGBeayc7I+VE/pF5wW3gACebJ1X3WKy3nBE5iBJICzrAFEohqbCD6eKtX c+teSdn2MWN4NYfn5B5MF7PB8/I5CtpSKX/u5Fmlp7E4E3FCqwXiQAbf4971l7oLmpL3 8TkzGLQwLwt8V3AaHcaXUr1zSOSB8Rz16BNI4mJzP/rlK8CKkozwHdq+9kT742XKAMeP V/MQ== 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 Return-Path: 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.52; Sat, 15 Apr 2023 07:47:08 -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 S229803AbjDOOm5 (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 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 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);