From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 4FC1DA00E6
	for <public@inbox.dpdk.org>; Tue, 16 Apr 2019 18:15:06 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id ED8131B551;
	Tue, 16 Apr 2019 18:14:58 +0200 (CEST)
Received: from vsmx012.vodafonemail.xion.oxcs.net
 (vsmx012.vodafonemail.xion.oxcs.net [153.92.174.90])
 by dpdk.org (Postfix) with ESMTP id 843041B49A;
 Tue, 16 Apr 2019 11:20:34 +0200 (CEST)
Received: from vsmx004.vodafonemail.xion.oxcs.net (unknown [192.168.75.198])
 by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTP id 161FEF34FB6;
 Tue, 16 Apr 2019 09:20:34 +0000 (UTC)
Received: from H270 (unknown [91.56.240.67])
 by mta-8-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 3396A19A968;
 Tue, 16 Apr 2019 09:20:23 +0000 (UTC)
Message-ID: <2851514C9E0449B4BA5C564727084D68@H270>
From: "Stefan Kanthak" <stefan.kanthak@nexgo.de>
To: <pbhagavatula@marvell.com>,
	<jerinj@marvell.com>
Cc: <dev@dpdk.org>, "Pavan Nikhilesh" <pbhagavatula@marvell.com>,
 <stable@dpdk.org>
References: <20190414052325.15984-1-pbhagavatula@marvell.com>
In-Reply-To: <20190414052325.15984-1-pbhagavatula@marvell.com>
Date: Tue, 16 Apr 2019 11:07:47 +0200
Organization: Me, myself & IT
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format="flowed";
 reply-type="original"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Windows Mail 6.0.6002.18197
X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.24158
X-VADE-STATUS: LEGIT
X-Mailman-Approved-At: Tue, 16 Apr 2019 18:14:55 +0200
Subject: Re: [dpdk-dev] [PATCH] eal: fix large multiple calculation in
	reciprocal division
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190416090747.lYczg0ipP7UkzKWMCmFzRAFIDJ1jfCMX2ftYYzkg4pI@z>

Pavan Nikhilesh <pbhagavatula@marvell.com> wrote Sunday, April 14, 2019 7:22 AM:


> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> 
> Fix large multiple calculation in 64 bit reciprocal division.

This "fix" has a SERIOUS bug, it needs yet another fix.
I recommend to understand code first before you copy it!

[...]

> + int64_t i;

uint i = 64;

> + uint64_t t;
> +
> + for (i = 1; i <= 64; i++) {

do {

> + t = x >> 63;

t = (int64_t) x >> 63; // t is either 0ULL or ~0ULL

> + x = (x << 1) | (y >> 63);
> + y = y << 1;
> + if ((x | t) >= z) {
> + x = x - z;
> + y = y + 1;
> + }

} while (--i > 0);

Stefan Kanthak