{"id":2226343,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2226343/?format=json","web_url":"http://patchwork.ozlabs.org/project/ovn/patch/20260422120003.445795-1-dceara@redhat.com/","project":{"id":68,"url":"http://patchwork.ozlabs.org/api/1.2/projects/68/?format=json","name":"Open Virtual Network development","link_name":"ovn","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260422120003.445795-1-dceara@redhat.com>","list_archive_url":null,"date":"2026-04-22T12:00:03","name":"[ovs-dev] lib: Fix dynamic_bitmap_last_set() on 32-bit architectures.","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e426fd7a9720a4f458fad2481aa9aa4c567864b4","submitter":{"id":76591,"url":"http://patchwork.ozlabs.org/api/1.2/people/76591/?format=json","name":"Dumitru Ceara","email":"dceara@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ovn/patch/20260422120003.445795-1-dceara@redhat.com/mbox/","series":[{"id":500998,"url":"http://patchwork.ozlabs.org/api/1.2/series/500998/?format=json","web_url":"http://patchwork.ozlabs.org/project/ovn/list/?series=500998","date":"2026-04-22T12:00:03","name":"[ovs-dev] lib: Fix dynamic_bitmap_last_set() on 32-bit architectures.","version":1,"mbox":"http://patchwork.ozlabs.org/series/500998/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2226343/comments/","check":"fail","checks":"http://patchwork.ozlabs.org/api/patches/2226343/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","ovs-dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ovs-dev@lists.linuxfoundation.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=ga4yu00N;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)","smtp2.osuosl.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=ga4yu00N","smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","smtp4.osuosl.org;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.a=rsa-sha256 header.s=mimecast20190719 header.b=ga4yu00N"],"Received":["from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0yTm2HHqz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 22:00:28 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id 20730422E8;\n\tWed, 22 Apr 2026 12:00:21 +0000 (UTC)","from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id r7awV26eQd7B; Wed, 22 Apr 2026 12:00:20 +0000 (UTC)","from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id 2A514422DC;\n\tWed, 22 Apr 2026 12:00:20 +0000 (UTC)","from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 0A30CC058F;\n\tWed, 22 Apr 2026 12:00:20 +0000 (UTC)","from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 04743C058D\n for <ovs-dev@openvswitch.org>; Wed, 22 Apr 2026 12:00:18 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id 20C884085D\n for <ovs-dev@openvswitch.org>; Wed, 22 Apr 2026 12:00:13 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id Up-5uuYDshZy for <ovs-dev@openvswitch.org>;\n Wed, 22 Apr 2026 12:00:12 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by smtp4.osuosl.org (Postfix) with ESMTPS id 84AD64081E\n for <ovs-dev@openvswitch.org>; Wed, 22 Apr 2026 12:00:10 +0000 (UTC)","from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-255-dcQu0S4YORmYX8s--bltQw-1; Wed,\n 22 Apr 2026 08:00:08 -0400","from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 9C34F1956062\n for <ovs-dev@openvswitch.org>; Wed, 22 Apr 2026 12:00:07 +0000 (UTC)","from cecil-rh.redhat.com (unknown [10.44.32.149])\n by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 270B71800347; Wed, 22 Apr 2026 12:00:05 +0000 (UTC)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections -\n client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2A514422DC","OpenDKIM Filter v2.11.0 smtp4.osuosl.org 84AD64081E"],"Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=dceara@redhat.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp4.osuosl.org 84AD64081E","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776859209;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=mhMCf1Lkq2gQdIm8/c/QYlSaa7TiMcPYowD+7cUNEmQ=;\n b=ga4yu00NYVdumuUj0No2hbk8JRTsY7glJhRGZBWXxB5glztBB2WdqrROEW9shhsiHzu0C0\n +kgeYWvxLjWxa2CEJERj+10mE4DW+22MDpkCJOOqR2gEbQ6MEUw2KujHjRnxPkYhQomXO1\n RRifOImXB+yADjPx8Ann5u12URoupAw=","X-MC-Unique":"dcQu0S4YORmYX8s--bltQw-1","X-Mimecast-MFC-AGG-ID":"dcQu0S4YORmYX8s--bltQw_1776859207","To":"ovs-dev@openvswitch.org","Date":"Wed, 22 Apr 2026 14:00:03 +0200","Message-ID":"<20260422120003.445795-1-dceara@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.93","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"dOOAA8u0KEtaISy3bJveTUSuu0qeEm7_e2e_anWdcT0_1776859207","X-Mimecast-Originator":"redhat.com","Subject":"[ovs-dev] [PATCH ovn] lib: Fix dynamic_bitmap_last_set() on 32-bit\n architectures.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","From":"Dumitru Ceara via dev <ovs-dev@openvswitch.org>","Reply-To":"Dumitru Ceara <dceara@redhat.com>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ovs-dev-bounces@openvswitch.org","Sender":"\"dev\" <ovs-dev-bounces@openvswitch.org>"},"content":"raw_clz64() always operates on uint64_t, so it counts leading zeros\nfrom bit 63.  The original expression used (BITMAP_ULONG_BITS - 1)\nwhich is 31 on 32-bit architectures where unsigned long is 32 bits.\nWhen a 32-bit value is implicitly promoted to uint64_t, raw_clz64()\nreturns a value 32 higher than expected, making the subtraction\nproduce incorrect (negative) results.\n\nUse the constant 63 to match raw_clz64()'s 64-bit input width.\n\nFixes: 39eb5b573388 (\"Add sparse array.\")\nAssisted-by: Claude, with model: claude-opus-4-6\nSigned-off-by: Dumitru Ceara <dceara@redhat.com>\n---\nNOTE: 32-bit OVN deployments are unlikely to exist in the wild, but\nthis fix ensures correctness in case someone attempts to build OVN\nfor a 32-bit target.\n---\n lib/ovn-util.h | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)","diff":"diff --git a/lib/ovn-util.h b/lib/ovn-util.h\nindex bcb344de44..b44c9c770a 100644\n--- a/lib/ovn-util.h\n+++ b/lib/ovn-util.h\n@@ -549,8 +549,8 @@ dynamic_bitmap_last_set(const struct dynamic_bitmap *db)\n             continue;\n         }\n \n-        return (BITMAP_ULONG_BITS - 1) - raw_clz64(db->map[i])\n-               + (BITMAP_ULONG_BITS * i);\n+        /* raw_clz64() operates on values promoted to uint64_t (64-bit). */\n+        return 63 - raw_clz64(db->map[i]) + (BITMAP_ULONG_BITS * i);\n     }\n \n     return -1;\n","prefixes":["ovs-dev"]}