Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mEC8B-0000dJ-DI for mharc-grub-devel@gnu.org; Thu, 12 Aug 2021 10:56:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEC89-0000d6-VX for grub-devel@gnu.org; Thu, 12 Aug 2021 10:56:25 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:35611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mEC85-0008V1-0D for grub-devel@gnu.org; Thu, 12 Aug 2021 10:56:25 -0400 Received: by mail-ed1-x52c.google.com with SMTP id dj8so2255641edb.2 for ; Thu, 12 Aug 2021 07:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YZy0VhfZC/Q+ElssKG+uQaH/Zqm3tDvNmCDfx0KTKI4=; b=PPcCm67AHyJPVpiCE1gaT00Ma9b+xPBwKS30eAkFh9sTtd23HRGlPgJCkqTKO/IhTV elYWEgoZKCe25mPW8OSy5gyiluB+TiJoT3H4n1GIR9BDfZZBClJT90O+/F7mQYYO8qTR ygQMA0e7LJxXE0zXcq2EkvnAlF6vQZtffKdb3PD+CqIFahOF+6J0bWVeaIfFttK9V3lM +ipDjklQHQPTuZag7oUlsz/HB3GKAIjPfYMXnwQmZnj2NLcDaTwPpoiu33MpIWBoKQ96 JgPS/s5ZmiD3vMTmelg07dXu0uQ6Vt13vqlZ1H/9XVshVAIffrdNgUvXeliZgNh/731O 6luA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YZy0VhfZC/Q+ElssKG+uQaH/Zqm3tDvNmCDfx0KTKI4=; b=jwQ1S7kSPPZDTLo4kXSRiZl1kCRadqZqWKaIM4IMNYle/2vAYWv8glz6J4EVv58X3J 8rdaSk8nXRmrYhC5UJKjeW+txdQaFKc+aGu4vWxcAV9bYgLGqSVsQRIGS6Lv0PiVVk+y 0hjgUSdh6b7pkbC+a2Dslfc/ZZurKqEGhe6v6VqLJCIAZVuIQLtWL/bLsV48BaFIEZW/ 0isTvIwzu4/rwvCNOhHNTiY+2RBjg5Glh8wj/8hL4UuKebxcH/Ggnq4kJiAPHO1St9qR 2ANrU2C6wtylZSpDAdn9gR26wMQG02AglsBGIS+jnCMep+1S1odS7meCqbseBCe5+DQv A5fg== X-Gm-Message-State: AOAM531CiCESOi3t2/B1iz1vJvqtas7Qvi5NBvbqKzTrdZQN0LxKQ3WO lDx4yx0/bfSEfzwK1hNGV/j1hsk8B0CX X-Google-Smtp-Source: ABdhPJxF07MgXoDm7K9/W0qHsY4f3TCzgzw0X/4MGojog+ee5T/FMMNm4jE1QX0AWay3kXAtkmUfYQ== X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr6063547edc.210.1628780178493; Thu, 12 Aug 2021 07:56:18 -0700 (PDT) Received: from HELIOS500.dhcp.waf.dog ([2001:470:1f14:97e::47c3]) by smtp.gmail.com with ESMTPSA id v24sm1233525edt.41.2021.08.12.07.56.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 07:56:18 -0700 (PDT) From: Wouter van Kesteren To: grub-devel@gnu.org Subject: [PATCH] commands/setpci: honor write mask argument Date: Thu, 12 Aug 2021 16:56:13 +0200 Message-Id: <20210812145613.2474649-1-woutershep@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=woutershep@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2021 14:56:26 -0000 In the case that one passes a write mask with : the write_mask is obtained from grub_strtoul and then promptly overwritten by 0xffffffff three lines later. This appears to have been so since the initial version of setpci in 2009. I'm suprised no one else has hit this issue in the past 12 years... --- grub-core/commands/setpci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/grub-core/commands/setpci.c b/grub-core/commands/setpci.c index 8a0c91f02..5917625f8 100644 --- a/grub-core/commands/setpci.c +++ b/grub-core/commands/setpci.c @@ -311,7 +311,6 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) write_mask = grub_strtoul (ptr, &ptr, 16); if (grub_errno) return grub_errno; - write_mask = 0xffffffff; } regwrite &= write_mask; } -- 2.32.0