Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1006695ybi; Fri, 2 Aug 2019 07:52:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfPVzgcPvElUAGUteH5Ju65q5icc6rGcjbNCaxFSHqOQwnQicseZtkTrLAPB/+pfDxGNAd X-Received: by 2002:a62:82c2:: with SMTP id w185mr62348679pfd.202.1564757526525; Fri, 02 Aug 2019 07:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564757526; cv=none; d=google.com; s=arc-20160816; b=ybvNPc481sdWHn+3rr6Yy9Uy6kPvgZ2tJYESzakUWExdfuOKZ547kxjSt38XXxSI56 xhX4BpxscBVBhZxjBRyUBVEpaAEF53H7AECUzBSLascHAXJAjwymPfC9cMSHgT1vHzUx lIMRskS8RV64StvaUdZLqlk2KfyUKm4ZVfbqlCtmzahfR9GG1qHQEl7gZ1puWFadOoFM iajs3W+JYR9xPQ99bZz7C+/ZUf8t3ZGjaUhkXlf0rdEtqAePHKMocBfMHmL86BrmkOZi oZ5Ks+8xSCXjbTjPIvcgF1UqoDhvJEmsNkKR27L2+FLWOZiz3oHi2/qiR5uAMcHRocmb nlzw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MSrt9Jg8EvsX3bErnhqtjjrt35YKIWEy/pfSSQ1zGZo=; b=tJDlfSG1s0/GbPAGwr0fOdQxw79xnu0Xn67rWKbfqVrXwmLFKAORcFhcpWv6ruMOdz 9PTCO3TwCGCfbuGoyvZgRqU0vAujfLVzfGqQiWgpHKXAuGB4UnGrO4IcgfIc9DccP14q 9KnMZcevGstBLOGb5h7OKb2BkCwb0YOYtTWL/G28lrQBzpcA6rVpFXFl8CkHFxhtcc3r cKr8sxpOxku7H5ApHuLqhrghDWsKYREQqedqZqQrHRZXOM6cRdDdzvtVsK0Jw9iOsxir ytfbYkf6PY7SqyHnVd/ZU8owRJlQBKM1rnqmfAfsMcDaDvGFi2ukNQeE+6JuHzp0rhOk 1I/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OUm8A8zx; 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 r190si37398936pfr.102.2019.08.02.07.51.51; Fri, 02 Aug 2019 07:52:06 -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=@kernel.org header.s=default header.b=OUm8A8zx; 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 S2404683AbfHBJbd (ORCPT + 99 others); Fri, 2 Aug 2019 05:31:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:57774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404675AbfHBJba (ORCPT ); Fri, 2 Aug 2019 05:31:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89F5D217F5; Fri, 2 Aug 2019 09:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738290; bh=dZpLJQa/iNeL7/6UDAIQwxGQuAixpVJtkTlR0A7g43s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUm8A8zxVfEau9XjtVDUNJxTdsRiUWSihD5T25tyGATZxklQyMY2yVhcBfVHB+wju LUsB13ytw40ZqZ4mhsciVlo2oCRyRM4uix7kKugbuj2VHB5956050Gi9OkdwGZYZ1Z 6gWPQdXu2ZzAUJOFnyaeVQYXUOGgima6wAdE9Q4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ferdinand Blomqvist , Thomas Gleixner , Sasha Levin Subject: [PATCH 4.4 046/158] rslib: Fix decoding of shortened codes Date: Fri, 2 Aug 2019 11:27:47 +0200 Message-Id: <20190802092213.410364483@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092203.671944552@linuxfoundation.org> References: <20190802092203.671944552@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c ] The decoding of shortenend codes is broken. It only works as expected if there are no erasures. When decoding with erasures, Lambda (the error and erasure locator polynomial) is initialized from the given erasure positions. The pad parameter is not accounted for by the initialisation code, and hence Lambda is initialized from incorrect erasure positions. The fix is to adjust the erasure positions by the supplied pad. Signed-off-by: Ferdinand Blomqvist Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20190620141039.9874-3-ferdinand.blomqvist@gmail.com Signed-off-by: Sasha Levin --- lib/reed_solomon/decode_rs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c index 0ec3f257ffdf..8eed0f9ac495 100644 --- a/lib/reed_solomon/decode_rs.c +++ b/lib/reed_solomon/decode_rs.c @@ -99,9 +99,9 @@ if (no_eras > 0) { /* Init lambda to be the erasure locator polynomial */ lambda[1] = alpha_to[rs_modnn(rs, - prim * (nn - 1 - eras_pos[0]))]; + prim * (nn - 1 - (eras_pos[0] + pad)))]; for (i = 1; i < no_eras; i++) { - u = rs_modnn(rs, prim * (nn - 1 - eras_pos[i])); + u = rs_modnn(rs, prim * (nn - 1 - (eras_pos[i] + pad))); for (j = i + 1; j > 0; j--) { tmp = index_of[lambda[j - 1]]; if (tmp != nn) { -- 2.20.1