Fix printf usage errors highlighted by covscan
This commit is contained in:
parent
af23effe82
commit
ef1820f565
103
backport-Fix-printf-usage-errors-highlighted-by-covscan.patch
Normal file
103
backport-Fix-printf-usage-errors-highlighted-by-covscan.patch
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
From b5ff1b7aa1f5f7c139b4b5e35be07a8d527c9336 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Simo Sorce <simo@redhat.com>
|
||||||
|
Date: Thu, 15 Jul 2021 07:24:37 -0400
|
||||||
|
Subject: [PATCH] Fix printf usage errors highlighted by covscan
|
||||||
|
|
||||||
|
More fallout from the type changes in the API.
|
||||||
|
|
||||||
|
Signed-off-by: Simo Sorce <simo@redhat.com>
|
||||||
|
Signed-off-by: Stephan Mueller <smueller@chronox.de>
|
||||||
|
---
|
||||||
|
apps/kcapi-dgst.c | 8 ++++----
|
||||||
|
apps/kcapi-enc.c | 2 +-
|
||||||
|
apps/kcapi-rng.c | 8 ++++----
|
||||||
|
3 files changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/apps/kcapi-dgst.c b/apps/kcapi-dgst.c
|
||||||
|
index 6e9350a..9cd99dc 100644
|
||||||
|
--- a/apps/kcapi-dgst.c
|
||||||
|
+++ b/apps/kcapi-dgst.c
|
||||||
|
@@ -139,7 +139,7 @@ static int cipher_op(struct kcapi_handle *handle, struct opt_data *opts)
|
||||||
|
|
||||||
|
if ((uint32_t)ret != kcapi_md_digestsize(handle)) {
|
||||||
|
dolog(KCAPI_LOG_ERR,
|
||||||
|
- "Unexpected digest output size: %d (expected %u)\n",
|
||||||
|
+ "Unexpected digest output size: %ld (expected %u)\n",
|
||||||
|
ret, kcapi_md_digestsize(handle));
|
||||||
|
ret = -EFAULT;
|
||||||
|
goto out;
|
||||||
|
@@ -157,7 +157,7 @@ static int cipher_op(struct kcapi_handle *handle, struct opt_data *opts)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- dolog(KCAPI_LOG_VERBOSE, "Digest of %d bytes generated\n", ret);
|
||||||
|
+ dolog(KCAPI_LOG_VERBOSE, "Digest of %ld bytes generated\n", ret);
|
||||||
|
} else {
|
||||||
|
if ((uint64_t)outsb.st_size != outlen) {
|
||||||
|
ret = ftruncate(outfd, outlen);
|
||||||
|
@@ -183,7 +183,7 @@ static int cipher_op(struct kcapi_handle *handle, struct opt_data *opts)
|
||||||
|
|
||||||
|
if ((uint32_t)ret != kcapi_md_digestsize(handle)) {
|
||||||
|
dolog(KCAPI_LOG_ERR,
|
||||||
|
- "Unexpected digest output size: %d (expected %u)\n",
|
||||||
|
+ "Unexpected digest output size: %ld (expected %u)\n",
|
||||||
|
ret, kcapi_md_digestsize(handle));
|
||||||
|
ret = -EFAULT;
|
||||||
|
goto out;
|
||||||
|
@@ -193,7 +193,7 @@ static int cipher_op(struct kcapi_handle *handle, struct opt_data *opts)
|
||||||
|
bin2hex(tmpbuf, kcapi_md_digestsize(handle),
|
||||||
|
(char *)outmem, outlen, 0);
|
||||||
|
|
||||||
|
- dolog(KCAPI_LOG_VERBOSE, "Digest of %d bytes generated\n", ret);
|
||||||
|
+ dolog(KCAPI_LOG_VERBOSE, "Digest of %ld bytes generated\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
diff --git a/apps/kcapi-enc.c b/apps/kcapi-enc.c
|
||||||
|
index 0f92c38..20588dd 100644
|
||||||
|
--- a/apps/kcapi-enc.c
|
||||||
|
+++ b/apps/kcapi-enc.c
|
||||||
|
@@ -273,7 +273,7 @@ static size_t outbufsize(struct kcapi_handle *handle, struct opt_data *opts,
|
||||||
|
opts->func_blocksize(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
- dolog(KCAPI_LOG_DEBUG, "Data size expected to be generated: %u",
|
||||||
|
+ dolog(KCAPI_LOG_DEBUG, "Data size expected to be generated: %lu",
|
||||||
|
outsize);
|
||||||
|
|
||||||
|
return outsize;
|
||||||
|
diff --git a/apps/kcapi-rng.c b/apps/kcapi-rng.c
|
||||||
|
index 1ace323..14af437 100644
|
||||||
|
--- a/apps/kcapi-rng.c
|
||||||
|
+++ b/apps/kcapi-rng.c
|
||||||
|
@@ -84,15 +84,15 @@ static ssize_t get_random(uint8_t *buf, size_t buflen)
|
||||||
|
#ifdef HAVE_GETRANDOM
|
||||||
|
ret = getrandom(buf, buflen, 0);
|
||||||
|
dolog(KCAPI_LOG_DEBUG,
|
||||||
|
- "Accessed getrandom system call for %u bytes", buflen);
|
||||||
|
+ "Accessed getrandom system call for %lu bytes", buflen);
|
||||||
|
#elif defined __NR_getrandom
|
||||||
|
ret = syscall(__NR_getrandom, buf, buflen, 0);
|
||||||
|
dolog(KCAPI_LOG_DEBUG,
|
||||||
|
- "Accessed getrandom system call for %u bytes", buflen);
|
||||||
|
+ "Accessed getrandom system call for %lu bytes", buflen);
|
||||||
|
#else
|
||||||
|
ret = read(random_fd, buf, buflen);
|
||||||
|
dolog(KCAPI_LOG_DEBUG,
|
||||||
|
- "Accessed /dev/urandom for %u bytes", buflen);
|
||||||
|
+ "Accessed /dev/urandom for %lu bytes", buflen);
|
||||||
|
#endif
|
||||||
|
if (0 < ret) {
|
||||||
|
buflen -= (size_t)ret;
|
||||||
|
@@ -286,7 +286,7 @@ int main(int argc, char *argv[])
|
||||||
|
ret = kcapi_rng_seed(rng, seedbuf, seedsize);
|
||||||
|
if (ret)
|
||||||
|
dolog(KCAPI_LOG_WARN,
|
||||||
|
- "User-provided seed of %lu bytes not accepted by DRNG (error: %d)",
|
||||||
|
+ "User-provided seed of %lu bytes not accepted by DRNG (error: %ld)",
|
||||||
|
(unsigned long)sizeof(buf), ret);
|
||||||
|
else
|
||||||
|
dolog(KCAPI_LOG_DEBUG,
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Name: libkcapi
|
Name: libkcapi
|
||||||
Version: 1.3.1
|
Version: 1.3.1
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: libkcapi - Linux Kernel Crypto API User Space Interface Library
|
Summary: libkcapi - Linux Kernel Crypto API User Space Interface Library
|
||||||
|
|
||||||
License: BSD or GPLv2
|
License: BSD or GPLv2
|
||||||
@ -13,6 +13,7 @@ Source0: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz
|
|||||||
Source1: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc
|
Source1: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc
|
||||||
|
|
||||||
Patch0: libkcapi-1.1.1-lib_Fix_kcapi_handle_destroy_closing_FD_0.patch
|
Patch0: libkcapi-1.1.1-lib_Fix_kcapi_handle_destroy_closing_FD_0.patch
|
||||||
|
Patch1: backport-Fix-printf-usage-errors-highlighted-by-covscan.patch
|
||||||
|
|
||||||
BuildRequires: clang coreutils cppcheck docbook-utils-pdf gcc hardlink
|
BuildRequires: clang coreutils cppcheck docbook-utils-pdf gcc hardlink
|
||||||
BuildRequires: libtool openssl perl systemd xmlto kernel-headers >= 4.10.0
|
BuildRequires: libtool openssl perl systemd xmlto kernel-headers >= 4.10.0
|
||||||
@ -194,6 +195,12 @@ popd
|
|||||||
%{_mandir}/man3/kcapi_*.3.*
|
%{_mandir}/man3/kcapi_*.3.*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Apr 15 2022 yixiangzhike <yixiangzhike007@163.com> - 1.3.1-3
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:fix printf usage errors highlighted by covscan
|
||||||
|
|
||||||
* Wed Jan 26 2022 yixiangzhike <yixiangzhike007@163.com> - 1.3.1-2
|
* Wed Jan 26 2022 yixiangzhike <yixiangzhike007@163.com> - 1.3.1-2
|
||||||
- Type:enhancement
|
- Type:enhancement
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user