Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1304513rwp; Thu, 13 Jul 2023 08:58:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFs3Dm30iQ3QUOcVyZ0gW5n2Axo1L+8gvo0w34D8PfLq9b8wg+bvqxMsGBQh/XUyELEyTOX X-Received: by 2002:a17:90b:11d5:b0:263:40e1:d4d9 with SMTP id gv21-20020a17090b11d500b0026340e1d4d9mr1217535pjb.47.1689263897967; Thu, 13 Jul 2023 08:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689263897; cv=none; d=google.com; s=arc-20160816; b=gVphIGFNE94vubMG03233VkvIjNYacwXVu95G51jMCdPlK5aitZnw/lKv6p0o5kbHl dGuxjHcYPst5/0ADuT38ILtQH7kB3yyfuPUajpU/X8orTXCu6tJSi32v4nwu/le+LOz4 I+fdyQd4RWH8wimRqYg/k659/W7HLC3WhcO7HryYNAVApwgYvTRArPvI69Z6vVTJ314N hpvN+we0nsQTxc+OSC0kC+cYG+l9djLiixVUJFMd6MZTS8ckbnq53vi//z5etQmReUXd p1L8qJbssWbL+14K2D8cnFeezh1DpdyBSghhdPrSyEeO/ucPyy1gpICMH53sj4MLML2A oklg== 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 :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=kDmHbfXwQYXihKFc96kKGD/ObmtOTyJypzzBaym7vos=; fh=Bug/SxQKi4a2/MESiGfjypoG+xa3lx3y32TX/vhzraw=; b=HiXZhhxuhKeD36luQc1qi3Vn8IlF/RkdiSedU5YpSk1Av4rO+4xtOBbIRxJKGDY4S0 naSDNHKH4alH1nQhM2XwVDxm3NYxVinNy2oYW5iYo0X0IrG3fsMjdyMSPm1MehMk1FDn Gg1GdULX91TX01WpyL7pN0YGnep55svQIsdfA4KxN64sfJMEmVutojNK2QZ0WuuQLh6p pFkbN3KPhcPj6tYMNRIQZMB4Dj2dKBZrVKbPOYpXOkhDtaUb3g11VAsG1jXLwBtTRGCD mJWDEm+2lQHBHLdOw1ZWpfLV1z4og6Se00AiyW/U2l68AWsi1jFjSriqWIQxnpkWOcxq tuPA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h17-20020a17090ac39100b002634d2ab01bsi12773694pjt.130.2023.07.13.08.58.05; Thu, 13 Jul 2023 08:58:17 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235038AbjGMPe4 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 13 Jul 2023 11:34:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235119AbjGMPef (ORCPT ); Thu, 13 Jul 2023 11:34:35 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD442213B for ; Thu, 13 Jul 2023 08:34:29 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-96-72mzMEKxMcawh9IWZJu5jg-1; Thu, 13 Jul 2023 16:34:27 +0100 X-MC-Unique: 72mzMEKxMcawh9IWZJu5jg-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 13 Jul 2023 16:34:26 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Thu, 13 Jul 2023 16:34:26 +0100 From: David Laight To: 'Leon Romanovsky' , Krister Johansen CC: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Shay Agroskin , Arthur Kiyanovski , David Arinzon , Noam Dagan , Saeed Bishara , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: RE: [PATCH net] net: ena: fix shift-out-of-bounds in exponential backoff Thread-Topic: [PATCH net] net: ena: fix shift-out-of-bounds in exponential backoff Thread-Index: AQHZs8j5z2bF0RP/C0e6CLHv2DmaRK+310mw Date: Thu, 13 Jul 2023 15:34:25 +0000 Message-ID: <20412c4fb06147c3b2e4ae90ed26fdb7@AcuMS.aculab.com> References: <20230711013621.GE1926@templeofstupid.com> <20230711072603.GI41919@unreal> In-Reply-To: <20230711072603.GI41919@unreal> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,PDS_BAD_THREAD_QP_64, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Leon Romanovsky > Sent: 11 July 2023 08:26 ... > > +#define ENA_MAX_BACKOFF_DELAY_EXP 16U > > + > > #define ENA_MIN_ADMIN_POLL_US 100 > > > > #define ENA_MAX_ADMIN_POLL_US 5000 > > @@ -536,6 +538,7 @@ static int ena_com_comp_status_to_errno(struct ena_com_admin_queue *admin_queue, > > > > static void ena_delay_exponential_backoff_us(u32 exp, u32 delay_us) > > { > > + exp = min_t(u32, exp, ENA_MAX_BACKOFF_DELAY_EXP); This shouldn't need to be a min_t() David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)