Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp978019iob; Fri, 13 May 2022 18:21:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyFGjr1ST1YJV/wouC4EDQzxr1rS0HRjUtVjiy4RWsW7sdiTTHpt+IuicIKlOjc5ynCDC8 X-Received: by 2002:a7b:ce04:0:b0:394:1f46:213 with SMTP id m4-20020a7bce04000000b003941f460213mr6733869wmc.157.1652491307463; Fri, 13 May 2022 18:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652491307; cv=none; d=google.com; s=arc-20160816; b=SCvG+tLtIPXu8Erk2t0fG1sAODZC9iyNNkENlYGsfCL/oWhqWD8+DHDveThjl0ilul 6aLKb9LgF3z/Limbg71jbuNz8zFOoOqzg4xbCwxH1l3By4qkwiTonKDGuEvrt8nFtZRJ KeZ+5EyfRshprAmLMEKWaqBbo0YtURZyJAHUbjEwEg5CrO91YcNl0tIgG51RjBiuKM/3 gK7/igSldq8ILDFhotsAmAGNS5xrwpbYNHQj15cV9ZsKvZnWT2SuajOtz0MgWNYtFdK9 fObHvOkrPMX/zt/zxXXlYuLeYWLMUSGd+MH+5awlXiik7/oc3akn/V6L6DS6RFxItRqI t/6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Dp5RjKDsRorlt15Q842QS1oD3zaqmbFzxKTc/+h/+tQ=; b=zmNq185XmdGdfMNIOv20/KN2Ys7CZktxjJLetRIZaicXBx7PRhEzCIXkLc/Q4FtdmQ 3fN52v62mpLmrtY20Isbo8eQJR3DwS5l0YFt7nBbldbrn1fzdud0pV6JPayJrORsSNlJ LEFjaWXqGl5rvKH0Xi2pQbmrAJxkmCV6w12mtjSS4fZFksYtkR/v+nW3tHqepHeiuzQV vo6xU0IMsfFDzPNCAUaqkV57UYxjKPqiovbA7Ip/JDUbk4YpUkMhiRoKc2Dhkb86D4cx TZCrGibOREjwYjs01JuEmhzS9lZBU0IanrcQTXJNMRpdV+6Jrm+CFn0ZfmZpGLYrgp6B A17g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MneGklh4; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l27-20020a05600c1d1b00b00393eaed422esi4215303wms.124.2022.05.13.18.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:21:47 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MneGklh4; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4A8313CC5AE; Fri, 13 May 2022 16:51:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351419AbiELIY3 (ORCPT + 99 others); Thu, 12 May 2022 04:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237176AbiELIY1 (ORCPT ); Thu, 12 May 2022 04:24:27 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03326633B1; Thu, 12 May 2022 01:24:26 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id q130so5543122ljb.5; Thu, 12 May 2022 01:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Dp5RjKDsRorlt15Q842QS1oD3zaqmbFzxKTc/+h/+tQ=; b=MneGklh48zNq8AAwN3ifgUtyhXr9lX5z/oy2m6O2tLieaDN9QE+UD3cbj/bsLZUqZa DBg6dcCXwHX1uivRZQF8U3eNzSq1Rj0c01fLeNNE6Nt6My9U8l8UZamKDZ+5j4LeVNFL OiAsbqlMfzpEro0I/bv5Jw/jg7gg4kWIK5B29d1fMMh4YmJJs+uPM/UWHy7L73jAnfL1 9tgx9SPSIM0cDU4qJuOmj71Hh8eq/jwMXe0wkcF1XIBSTCTa5SUjFewve6xDBBaIfT46 G14Xxr+ZfnSxKCISOaFW2d2eAEmTCO85yVFmSz0zsHKgDAjFKQtJ8y9BW7GPwXTy3EoJ OGUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Dp5RjKDsRorlt15Q842QS1oD3zaqmbFzxKTc/+h/+tQ=; b=nj7gP7bbvSfHbxFpHbrjfJcMpmC5YgWxj7FzN7hrCKqmPXjPZfQD61Jx0fdcDB0d7t ArdJoOZVjikgn/FdIX3WFe1l8cUl6RBgn6zkSMylWA9NRMY8juPxN+XcnPJAPRWhfmsa m8Q7f4oYg77s93TaNY4Ua8LV4iAX6nFJVRrHgyEXavYNmhfKJMYsL1vliBu8tf4x0t/w eQccWhe1Ov7mk7P3nRIcmPQT/C8u8lCBxeHvgDRkthhcsh+jXTWXn/Kp3arsnmgbP9Rx V9Osbx6KTOWiDIjW6dVrFKJVETYzxHaNBOhVfqGToRZB/eFCSWe/01bnOvbGmBSHv0rg 6lSA== X-Gm-Message-State: AOAM5316d9adEm34j631djJFYbtwOLtyNwqA3dgq4asGU/957hWBn14U sZRCkWYcCkg2XOe0/UK5IiMq4n5UxGQ= X-Received: by 2002:a2e:bb8e:0:b0:250:76dd:3bd9 with SMTP id y14-20020a2ebb8e000000b0025076dd3bd9mr20340342lje.71.1652343863752; Thu, 12 May 2022 01:24:23 -0700 (PDT) Received: from [192.168.1.103] ([31.173.83.174]) by smtp.gmail.com with ESMTPSA id u17-20020a05651206d100b00474018dfb76sm673110lff.157.2022.05.12.01.24.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 May 2022 01:24:23 -0700 (PDT) Subject: Re: [PATCH v3 09/23] ata: libahci_platform: Sanity check the DT child nodes number To: Serge Semin , Damien Le Moal , Hans de Goede , Jens Axboe Cc: Serge Semin , Alexey Malahov , Pavel Parkhomenko , Rob Herring , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20220511231810.4928-1-Sergey.Semin@baikalelectronics.ru> <20220511231810.4928-10-Sergey.Semin@baikalelectronics.ru> From: Sergei Shtylyov Message-ID: <42dfc76f-a9d9-8e63-874d-b7459cef326c@gmail.com> Date: Thu, 12 May 2022 11:24:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20220511231810.4928-10-Sergey.Semin@baikalelectronics.ru> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 5/12/22 2:17 AM, Serge Semin wrote: > Having greater than (AHCI_MAX_PORTS = 32) ports detected isn't that Having greater than AHCI_MAX_PORTS (32) ports detected? > critical from the further AHCI-platform initialization point of view since > exceeding the ports upper limit will cause allocating more resources than > will be used afterwards. But detecting too many child DT-nodes doesn't > seem right since it's very unlikely to have it on an ordinary platform. In > accordance with the AHCI specification there can't be more than 32 ports > implemented at least due to having the CAP.NP field of 4 bits wide and the It's 5 bits wide, actually... > PI register of dword size. Thus if such situation is found the DTB must > have been corrupted and the data read from it shouldn't be reliable. Let's > consider that as an erroneous situation and halt further resources > allocation. > > Note it's logically more correct to have the nports set only after the > initialization value is checked for being sane. So while at it let's make > sure nports is assigned with a correct value. > > Signed-off-by: Serge Semin [...] MBR, Sergey