Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2703601ybb; Sat, 30 Mar 2019 11:31:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8cspxXeIifzDuzJVcP0HsjfCC+L3VvypXdaHNTn6TTyUVWRE+27VTo8zWNaj2LQP5p+X3 X-Received: by 2002:a63:4a5a:: with SMTP id j26mr43121252pgl.361.1553970672453; Sat, 30 Mar 2019 11:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553970672; cv=none; d=google.com; s=arc-20160816; b=PU8UetaDSpQG2WZxKTuP9Jiwg6gLqznRJXBs8WUUOxIXpvgLgn6ZgT5m/9HOXsQPzJ i4AC47HQoHwwY+Bkxo4wAwhRcpKtIyqydo7BV7diNm0B2erdl6pKk+Vmao9F8aegFYML 4dQqUwZscKPZEPRxAa+p2GDRAGPAxR8xbdZaI2UgUV2f7zFMNqNtfQkuXVeYmX3TyjgP b7TctTBIVfbYJXQNywwiMLcIFLc8hargKVnR3gLFnYLIf1OflxNKxZ7DLgLaTaxM/pGK HWqe9tt1mkQ8BAlmE7B6r6Wb76KfhqPTPq1JOZSoEiMIqeRYbqx6+ZEZAjw2cassO1yW TDgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=syCSLdZUygR2irP3Dt4dkGth8Ul25f2kR+nZnXbK8DA=; b=PoEsqD4wp9FXppnn65VhWVm37CfaGUYaCOLAjCdQB+28N+g6BLi3t+Q5QBtQrjf7Df wYks6iwWKTi8V5sayO+ET8cMnLXcbzJ1NaO5TO+6FSdL1gjn+ZWUN8O5PTXgCXB0ZJ43 w0fgJoYbfX8xE9f7qz+L1h1YXRRoaYZZAdfglvEoxtAGb7Nm4DNdfLEMJg2FnM74VT6B qAGJOadp+SlES2JelHo86tkTPdSubhHpjREOTRqjk4+QbT8GJNj0BhOFAJv4OeLnL2p7 TPIGvyAMw190Ibe1j7lVAzJin0W9zF5H5NZpBcwwPrUK6ZqMoQkCpl9lY3R7aL0Vc3n4 3t4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V+TwMfj5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si4894174pls.226.2019.03.30.11.30.57; Sat, 30 Mar 2019 11:31:12 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V+TwMfj5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731054AbfC3SaP (ORCPT + 99 others); Sat, 30 Mar 2019 14:30:15 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45114 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731028AbfC3SaO (ORCPT ); Sat, 30 Mar 2019 14:30:14 -0400 Received: by mail-lj1-f195.google.com with SMTP id y6so4631848ljd.12 for ; Sat, 30 Mar 2019 11:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=syCSLdZUygR2irP3Dt4dkGth8Ul25f2kR+nZnXbK8DA=; b=V+TwMfj5OJW4q+cbs/e3s6OMCbKAP84cto4V4PD7QRRboe0JJPkRJ8wk5QWWy/u3Fp CiJlcYuwVkWVZdcWDjsRPfhnfSHj2sTgON1VQiUJsLUIpDOu8+npuXlba81ZulfgQ3MR scF/fxfzbSg9CMc2ITmRmLk2jbemfF50xOmBkwiaXj6jGipQqb8SFeHlIG4+QFPCJVa4 r9+nXWYu48/jcpp6z/KKuku3bEXpNFhnL0wNpY4mSc10qr4ZfDEAEO4iFLAOKq3AzjA/ VFPg8Sl2Z1f99wgziBr9MKx1cA07JiZwYnJkXPTbtg4DXyRnr/E5JWP/5gxqu5YTda2y F+Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=syCSLdZUygR2irP3Dt4dkGth8Ul25f2kR+nZnXbK8DA=; b=e73GOG3YnRPnhx/AUhIAGeYVZLBs9yEbtg8ORh8jy9Qs/jiHPxOy5VWBZs2T/Cweb4 Sc2Fqq230XTVU/PlZHTWas0X3CDTm0XtEQUahfiKvaC61e/GW8kmRs9LX9mTx6n3K4Z4 aGvozVKmwwOWyOOnrKH9dA9O0ZrgJolOSwXirfI+ph2Fw/DN+f46JMpebGppb4s6i0aW i/GuAqkD/7uXsmDRiv+zzSq6TfPG1MEu5tSe8zpbil6ck3J7N45IUOMw+hAMXim+8aGn 1B33PbZy9vXmAqp0esEqUMY7pMq8hOa5glQzWJ3OeVOp0mnZ0pxbpurdA9hG8YR5PVRF NOqg== X-Gm-Message-State: APjAAAUIsMEZvCHgVo3hftJeilxsUfYEvpuCDCUaRPVeMbmywd2LeMSg lTdpbb9PbaCFAu8R0+UavW07yXxf X-Received: by 2002:a2e:8648:: with SMTP id i8mr31718622ljj.166.1553970611817; Sat, 30 Mar 2019 11:30:11 -0700 (PDT) Received: from localhost.localdomain (v902-731.aalto.fi. [130.233.10.238]) by smtp.gmail.com with ESMTPSA id o7sm1060058ljj.23.2019.03.30.11.30.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 Mar 2019 11:30:11 -0700 (PDT) From: Ferdinand Blomqvist To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner Subject: [RFC PATCH 3/7] rslib: decode_rs: Fix length parameter check Date: Sat, 30 Mar 2019 20:29:43 +0200 Message-Id: <20190330182947.8823-4-ferdinand.blomqvist@gmail.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190330182947.8823-1-ferdinand.blomqvist@gmail.com> References: <20190330182947.8823-1-ferdinand.blomqvist@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The length of the data load must be at least one. Or in other words, there must be room for at least 1 data and nroots parity symbols after shortening the RS code. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/decode_rs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c index 3313bf944ff1..22006eaa41e6 100644 --- a/lib/reed_solomon/decode_rs.c +++ b/lib/reed_solomon/decode_rs.c @@ -39,7 +39,7 @@ /* Check length parameter for validity */ pad = nn - nroots - len; - BUG_ON(pad < 0 || pad >= nn); + BUG_ON(pad < 0 || pad >= nn - nroots); /* Does the caller provide the syndrome ? */ if (s != NULL) -- 2.17.2