From patchwork Tue Jun 21 18:02:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 9191189 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 36F7060756 for ; Tue, 21 Jun 2016 18:06:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BD051FF12 for ; Tue, 21 Jun 2016 18:06:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2034D28329; Tue, 21 Jun 2016 18:06:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B155A1FF12 for ; Tue, 21 Jun 2016 18:06:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u5LI2vQI022933; Tue, 21 Jun 2016 14:02:57 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u5LI2tvF013699 for ; Tue, 21 Jun 2016 14:02:55 -0400 Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5LI2tD2002918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 21 Jun 2016 14:02:55 -0400 Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5382C73059 for ; Tue, 21 Jun 2016 18:02:54 +0000 (UTC) Received: by mail-pa0-f53.google.com with SMTP id hl6so8410486pac.2 for ; Tue, 21 Jun 2016 11:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=VEXMp6WjNgK+uyz4A38y1bX2PyKMwsItqiEK4gsjuVE=; b=InTH1GPqGFEQIyNb7HITzbUwZfYNmnv4gqOL0Jb25+R1bYBgSVMOOm83N82llStIOV QSoSAmevaPzC5hqIH13Cq9f/VbI2FAIu28PXTQ6tKDaoeUpMHLzsa4trMG1AejN8vaiU vE9hoEfT6tI/q+JB9OVNrVxWu3m+YvBZXHJk/1J3CKeHayAHqYZ250OuHqiaqAU1qCo0 hO67h7R5EsL0KiwYZkyYfkrfJYsdyBzc98CsFLipZTtnubOB9sDQEw6eepd1oaakV2x4 NkOR3mV7+ZqLfZdGbSlS4c+eAMLtkc96vAbgvkWa59gz1xJSK4PkvsniFxQ9E85I1fpj /FmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VEXMp6WjNgK+uyz4A38y1bX2PyKMwsItqiEK4gsjuVE=; b=S3lgUbe9f95hDGv6YQZx4CGymW/GnWw3W07ZFCmOhw74T6/XJJSwC/05DQIT7rMY0C T82VwoLffMXkOGst3VL4hQ1f+dkFmnBMy/ATmN6WtR8/YHIgtaCJqfaa/iLCmQQm4q+m Lgni66dOLCwxA1EFvVQ2KOnQTXMFZy1CFLLgU7y9V6bNKYca2cQFNYHL1a2BwHnscJp5 pAeR7zJCwqvgGWp/mApB1dax2feCp/1BZ2xRpkRmFks1sGBm2fXsnzBJ+GXs2h8kVvKl 3Aj3ulWYz+2teZfQjq2TbAnGR2cmtHcv1pXRpIg4BsVoL8lLRRpOh2fantVk7UfBa6Ax Fsfw== X-Gm-Message-State: ALyK8tKG72i9qgg+gHcjZ9sgj1eV0xIhjQx88PTbBxzeNfPzy0rnuEh+N/SdKGm+9Td1+oMz X-Received: by 10.66.54.35 with SMTP id g3mr29815810pap.30.1466532173650; Tue, 21 Jun 2016 11:02:53 -0700 (PDT) Received: from samitolvanen.mtv.corp.google.com ([172.22.112.90]) by smtp.gmail.com with ESMTPSA id o6sm21273385pax.9.2016.06.21.11.02.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Jun 2016 11:02:53 -0700 (PDT) From: Sami Tolvanen To: Mike Snitzer Date: Tue, 21 Jun 2016 11:02:42 -0700 Message-Id: <1466532162-54016-1-git-send-email-samitolvanen@google.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 21 Jun 2016 18:02:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 21 Jun 2016 18:02:54 +0000 (UTC) for IP:'209.85.220.53' DOMAIN:'mail-pa0-f53.google.com' HELO:'mail-pa0-f53.google.com' FROM:'samitolvanen@google.com' RCPT:'' X-RedHat-Spam-Score: -1.832 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, RP_MATCHES_RCVD, SPF_PASS) 209.85.220.53 mail-pa0-f53.google.com 209.85.220.53 mail-pa0-f53.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Sami Tolvanen Subject: [dm-devel] [PATCH] dm verity fec: fix block calculation X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP do_div was replaced with div64_u64 at some point, causing a bug with block calculation due to incompatible semantics of the two functions. Signed-off-by: Sami Tolvanen Fixes: a739ff3f543a ("dm verity: add support for forward error correction") --- drivers/md/dm-verity-fec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c index 459a9f8..0f0eb8a 100644 --- a/drivers/md/dm-verity-fec.c +++ b/drivers/md/dm-verity-fec.c @@ -453,9 +453,7 @@ int verity_fec_decode(struct dm_verity *v, struct dm_verity_io *io, */ offset = block << v->data_dev_block_bits; - - res = offset; - div64_u64(res, v->fec->rounds << v->data_dev_block_bits); + res = div64_u64(offset, v->fec->rounds << v->data_dev_block_bits); /* * The base RS block we can feed to the interleaver to find out all