Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9984305ybi; Wed, 24 Jul 2019 13:32:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaZuSZBKNhADKUWD3xrqvSoCTYMIXOjaWf957aMFVHQHd/HhUrc3fYpbNZ1iuYUq1DmZuf X-Received: by 2002:a63:2148:: with SMTP id s8mr81218433pgm.336.1564000365840; Wed, 24 Jul 2019 13:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000365; cv=none; d=google.com; s=arc-20160816; b=CUJfXuz+ztBOhcrkobQz27FXt9MpzRIGdGjKI/2cSdgJFjg3me2ceBedTqYnN6noB+ KZ6KFQWAMUb292ViFnppJxANHuJTs3KwjlCEFNVblo2ttvF0+1Dwh9vFXgyY7NWbcIox LYrAlI6xiF5UOyW8n9zUZhoCsHh5xQm+7WGKgCLDz7OgCYixIHbPtY5fFaj2Ohh/i04/ LlZ8y92poTCSqiHXn7K8CKUUme/Fkc5R9oJVWlyVC3qZTJjDV9jUxa13sT6ORfezkT7/ 9e8kNp0jUHtNkF/3o+c2CwO+eJXU7JwcVObqa91By6MbXwkjCgJZ/4sj26DZbWPXU4Au rmqA== 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=ttU4eewplD7LZUUVLoXtzFnOtLUGTDfWxvCFxS6NchY=; b=jkbuY+OVyb64oaGRizfAx51kEDIHOuo4OhTdR3ln+j0y05RagDFD8FZurSw/W9AKu7 2io+5FQ5+6vsf6muzpQhxo+cZ7Vxsi3AFg/qGpc1yKJ+WL1+ZnKAgdZV/sTOniV5nnM5 iOenvke6D8rLMrylCjRmu0fDnMRvuwcl/MXfZl5CEaOPWmioWVmMxiSi7WM37A9gkSgk 7lMloTWlj1CVAOpSLm5OIpCee3ug3tRyAh4LMdOjxcpeAhwVc96+EMKXEAMSOznTqtw4 346o/vVUgMyflKx+wr4Tl+vM27jcyCaO3dEok+1nD9TsePSe+QZkQTSgkxIvzLIaOllF gB9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RNTwYvEL; 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 l191si15753917pge.94.2019.07.24.13.32.31; Wed, 24 Jul 2019 13:32:45 -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=RNTwYvEL; 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 S1728886AbfGXUbO (ORCPT + 99 others); Wed, 24 Jul 2019 16:31:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:51448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388442AbfGXTa7 (ORCPT ); Wed, 24 Jul 2019 15:30:59 -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 23239218EA; Wed, 24 Jul 2019 19:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996658; bh=rxnY3wrfDDLzY2Euytksiym4+Ent8PQJYLcAuC5pEYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RNTwYvELR2+v4eqHBz/e24hIWD+JQ76UxtSU6TJRSsuuDhpkFnPXY04En3MFcqsGR xBl5jWtIfkQdOJvkJ7HfH76332v32iWguhJ0i1yL+OUox7YJ5X5UkYGzk1BjLVKjfO ub436rzcLMX8uUvdXP0/j6BopIa4124jhHvb5U3w= 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 5.2 173/413] rslib: Fix decoding of shortened codes Date: Wed, 24 Jul 2019 21:17:44 +0200 Message-Id: <20190724191747.314463325@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@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 1db74eb098d0..3313bf944ff1 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