From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lCvpS-0006TI-9W for mharc-grub-devel@gnu.org; Thu, 18 Feb 2021 21:47:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCvpJ-0006LL-6V for grub-devel@gnu.org; Thu, 18 Feb 2021 21:47:30 -0500 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]:35629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCvpA-00004z-Ut for grub-devel@gnu.org; Thu, 18 Feb 2021 21:47:28 -0500 Received: by mail-qk1-x732.google.com with SMTP id x14so4367901qkm.2 for ; Thu, 18 Feb 2021 18:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QZ7Vtg69Vxpb5e3sN1SbUTty8RXz+b0/1u8t3Db5Gtw=; b=Zup07MVnsQCoOKQNl+rJrSq2Rh8D0+BjXK/auQ9kpreBw2+cuzp5WQPMZS1LDYbUTn puyGk+jEqkWp6de27CJ/oHPrn9nvBmSl42z9QmRMKVcNNw8dUkYyk9FOMVETAowiQnHw 8/7qY21Ql1ts5Q6l8h7X9yS0c3hAokUx6rifsmvw/Ws4aqh1PTndIWRMO/kGiMO1WW/I JtqH5rtfb8Mw3xIO8mNQrgCQHMN333agc3piRPKlymVxgrUDvTcJ3T9VC1e4Qs5ekGye KKSv94pI1T9QmgueeB1HTLm6rjBHhlkoZbJ7ErCRHBIlMx9uOkyXbyHKexmBikOX166R c0/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QZ7Vtg69Vxpb5e3sN1SbUTty8RXz+b0/1u8t3Db5Gtw=; b=q1MBtuYLIRsIM3RfUUEA4SUup1pbsWf3sWLApmoxGw2ObhlXoe3eTjcnv534I7dv2C tDJgBvPmGNSMlL/Rn5CVLLJHWR9WWD1j94EvVBEx2AFZl1wmHC0xjIt70f2TmOhoP1kc 8xLwmzUM/IuyPpnwruap6UaL7W7+aNTGB6eNiSAKs87mgNC34qT4NuZ45Dj9YxD/1b7/ KI2lotIbNdJErQbVruvw6E92jWywKeT6L7hLgMmvkFxuTYRh20ugncmB4OVySAmh7rnG n0OzEsoYp7rOV2FRO3kdGwa/ahLDhcVPRZMbzGrkJIqAaV0X+JPgshx+br5FASywe4/S 57gQ== X-Gm-Message-State: AOAM530hosvpOm64X9ng7jUWgF3TWa1eO/bOJyqvwGFLbd6HAAe0tON5 lc5ltOffwU+OdUucSjHT8fHaZT0uzP+WpA== X-Google-Smtp-Source: ABdhPJwttLqxYiDG8gzCrPqLxFa1SjKVf9jIQamW7t70gkx08ekMZRVy35hH/DTeudPORbudYAKG9g== X-Received: by 2002:a37:9e57:: with SMTP id h84mr7583783qke.463.1613702839084; Thu, 18 Feb 2021 18:47:19 -0800 (PST) Received: from localhost.localdomain ([2605:a601:aac5:3700:c323:c101:d96b:34f1]) by smtp.gmail.com with ESMTPSA id y2sm5341515qkj.56.2021.02.18.18.47.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 18:47:18 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org Cc: Daniel Kiper , Glenn Washburn Subject: [PATCH v4 00/13] error: Do compile-time format string checking on grub_error Date: Thu, 18 Feb 2021 20:47:01 -0600 Message-Id: X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=development@efficientek.com; helo=mail-qk1-x732.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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: Fri, 19 Feb 2021 02:47:30 -0000 This patch series fixes all compile errors due to format string issues on grub_error. This was tested against nearly all supported platforms successfully. This is important because earlier versions of these changes compiled successfully on x86 platforms, but had issues on other ones not tested. All patches except the last fix actual format string issues. The last patch turns format string issues into errors. This is a good idea because it will help to prevent introducing new format string issues into the code. Since, I presume, Daniel does not do not do a build test for all architectures before committing to master, this will not ensure that no format string issues get introduced into the code. However, it should flush out any format string issues when the CI build is done. Many of these changes are fairly obvious. I tried to use the PRI*GRUB_*_T macros as much as I could and to not cast arguments. There are some notable exceptions. There is some code that uses the same grub_error code in both 32 and 64 bit architectures (riscv), so casting was needed to force the larger storage type. The second to last patch for zfs is still confounding to me as to why the macro PRIuGRUB_UINT64_T was not expanding to llu, and yet the compiler was saying the argument was a long long unsigned. The tests results can be found here: https://gitlab.com/gwashburn/grub/-/pipelines/255133408 Glenn Glenn Washburn (13): misc: Format string for grub_error should be a literal error: grub_error missing format string argument error: grub_error format string add missing format code dmraid_nvidia: Format string error in grub_error grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t pgp: Format code for grub_error is incorrect efi: Format string error in grub_error error: Use %p format code for pointer types error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error error: Use format code PRIxGRUB_UINT64_T for 64-bit arg in grub_error error: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock in grub_error error: Use format code llu for 64-bit uint bp->blk_prop in grub_error error: Do compile-time format string checking on grub_error grub-core/commands/pgp.c | 2 +- grub-core/disk/ata.c | 4 ++-- grub-core/disk/cryptodisk.c | 12 ++++++++---- grub-core/disk/dmraid_nvidia.c | 2 +- grub-core/efiemu/i386/loadcore64.c | 3 ++- grub-core/fs/hfsplus.c | 3 ++- grub-core/fs/zfs/zfs.c | 4 ++-- grub-core/kern/arm64/dl.c | 3 ++- grub-core/kern/efi/efi.c | 2 +- grub-core/kern/efi/mm.c | 5 +++-- grub-core/kern/ia64/dl.c | 3 ++- grub-core/kern/riscv/dl.c | 5 +++-- grub-core/kern/sparc64/dl.c | 3 ++- grub-core/kern/x86_64/dl.c | 3 ++- grub-core/loader/efi/chainloader.c | 4 ++-- grub-core/loader/i386/bsd.c | 3 ++- grub-core/loader/i386/pc/linux.c | 4 ++-- grub-core/net/tftp.c | 2 +- grub-core/parttool/msdospart.c | 4 ++-- grub-core/script/lexer.c | 2 +- grub-core/video/bochs.c | 4 ++-- include/grub/err.h | 3 ++- 22 files changed, 47 insertions(+), 33 deletions(-) -- 2.27.0