Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp70118imu; Thu, 8 Nov 2018 05:11:58 -0800 (PST) X-Google-Smtp-Source: AJdET5dWxAfOz1bCwZOUdMwCK41XlD9RzI2yv1Ua8FN5rYhZGX4TcFFHbvf5aJyXsaYqtSFN5cjM X-Received: by 2002:a62:4718:: with SMTP id u24-v6mr4472910pfa.107.1541682718802; Thu, 08 Nov 2018 05:11:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541682718; cv=none; d=google.com; s=arc-20160816; b=aHwwBwRhLXYXSHwAlobztzRgeXnhJEGIW3fuNSNDTajelxWc8lgTgI5W4kBiLzj9GQ xQxeZeJx+3GQ5zsUt5VN5OkspActPL6+AGaN5JqFycEiovl6fErTnVbYeOBggu0EU/8h 6y7NFCvvVH9Dla6VByKxtF5cpewYyzD8AISqIA+v4Fdt3Dor+e35SvRjqqj9JExhEMg9 hxwnTSQ8k4MlflSAOfX4IuOhEM5126tsOsYcOqkS1zPVlBDaa9klZoLPaZvWL7QMtxcL ir8FOXhz2zWShqOJPRMcoLC7Y+B7l74mOvZHGBpL28zeQIm/BNu4EYNyX2WpvG4hDfMI KPxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=ZyhVoL44ghX84wJIAxdiKiSPLyJNIkvFb9QVgWwv1JQ=; b=qcwWqSoyqToRdjVfRTDytjcjR27Sv4Z8F+R41LRk83A/EQJ2lsejgX+F/3oYowIE0O fRqKbw7e6vw2VJS2T99/46AxDR5fqJZavhnPDqfK03URqsLrDkcLk7KOlEWfLxihAKZH GMLelpoMHVVP+QOWJmCkxke7JK/y2c44BM0k5t9X3qtXChqZo4tN04RYKkMqXI6jSF2x cg+qXNWsrMCZs9dy26/UchL2l88OoHmqSAWIibFWqKCBuATBY5w+f8MmFkfV72QDF1gH 6TBWH4IMLquhj1EoMro5MEgFZYb6pi7UuwewZJN/6JLTDDnevN3o7Bc5yjmwP18fErAY SPrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m72-v6si3950131pga.114.2018.11.08.05.11.24; Thu, 08 Nov 2018 05:11:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726929AbeKHWoD (ORCPT + 99 others); Thu, 8 Nov 2018 17:44:03 -0500 Received: from mail.bootlin.com ([62.4.15.54]:37374 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726417AbeKHWoD (ORCPT ); Thu, 8 Nov 2018 17:44:03 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id B51F7224CD; Thu, 8 Nov 2018 14:08:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from bbrezillon (aaubervilliers-681-1-30-49.w90-88.abo.wanadoo.fr [90.88.15.49]) by mail.bootlin.com (Postfix) with ESMTPSA id 720FB207BB; Thu, 8 Nov 2018 14:08:26 +0100 (CET) Date: Thu, 8 Nov 2018 14:08:26 +0100 From: Boris Brezillon To: Cc: , , , , , , , Subject: Re: [PATCH 3/7] mtd: spi-nor: add restriction for nmaps in smpt parser Message-ID: <20181108140826.428b77ed@bbrezillon> In-Reply-To: <20181108135447.36a0314c@bbrezillon> References: <20181108110653.21063-1-tudor.ambarus@microchip.com> <20181108110653.21063-4-tudor.ambarus@microchip.com> <20181108135447.36a0314c@bbrezillon> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Nov 2018 13:54:47 +0100 Boris Brezillon wrote: > > - while (i < smpt_len) { > > + for (nmaps = 0; i < smpt_len; nmaps++) { > > + /* > > + * The map selector is limited to a maximum of 8 bits, allowing > > + * for a maximum of 256 possible map configurations. The total > > + * number of map configurations should be addressable by the > > + * total number of bits described by the detection commands. > > + */ > > + if (ncmds && nmaps >= (1 << (ncmds + 1))) > > + break; > > + > > Maybe I missed something but it sounds like this change is just > optimizing the SPMT parsing a bit, and to be honest, I'm not sure this > is really needed. Most of the time, smpt_len will be rather small, so > trying to bail out earlier is not bringing much perf improvements. To make it clearer, I don't think the extra complexity is worth the tiny perf improvement.