From ea5fdf2ded7ae33ba635bc54d3d1ef35eab07dd0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 9 May 2021 17:18:27 +0200 Subject: [PATCH] 5.4-stable patches added patches: fix-misc-new-gcc-warnings.patch security-commoncap-fix-wstringop-overread-warning.patch --- queue-5.4/fix-misc-new-gcc-warnings.patch | 81 +++++++++++++++++++ ...oncap-fix-wstringop-overread-warning.patch | 46 +++++++++++ queue-5.4/series | 2 + 3 files changed, 129 insertions(+) create mode 100644 queue-5.4/fix-misc-new-gcc-warnings.patch create mode 100644 queue-5.4/security-commoncap-fix-wstringop-overread-warning.patch diff --git a/queue-5.4/fix-misc-new-gcc-warnings.patch b/queue-5.4/fix-misc-new-gcc-warnings.patch new file mode 100644 index 00000000000..d407c898bc3 --- /dev/null +++ b/queue-5.4/fix-misc-new-gcc-warnings.patch @@ -0,0 +1,81 @@ +From e7c6e405e171fb33990a12ecfd14e6500d9e5cf2 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Tue, 27 Apr 2021 17:05:53 -0700 +Subject: Fix misc new gcc warnings + +From: Linus Torvalds + +commit e7c6e405e171fb33990a12ecfd14e6500d9e5cf2 upstream. + +It seems like Fedora 34 ends up enabling a few new gcc warnings, notably +"-Wstringop-overread" and "-Warray-parameter". + +Both of them cause what seem to be valid warnings in the kernel, where +we have array size mismatches in function arguments (that are no longer +just silently converted to a pointer to element, but actually checked). + +This fixes most of the trivial ones, by making the function declaration +match the function definition, and in the case of intel_pm.c, removing +the over-specified array size from the argument declaration. + +At least one 'stringop-overread' warning remains in the i915 driver, but +that one doesn't have the same obvious trivial fix, and may or may not +actually be indicative of a bug. + +[ It was a mistake to upgrade one of my machines to Fedora 34 while + being busy with the merge window, but if this is the extent of the + compiler upgrade problems, things are better than usual - Linus ] + +Signed-off-by: Linus Torvalds +Cc: Andrey Zhizhikin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/intel_pm.c | 2 +- + drivers/media/usb/dvb-usb/dvb-usb.h | 2 +- + include/scsi/libfcoe.h | 2 +- + net/bluetooth/ecdh_helper.h | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/i915/intel_pm.c ++++ b/drivers/gpu/drm/i915/intel_pm.c +@@ -2966,7 +2966,7 @@ int ilk_wm_max_level(const struct drm_i9 + + static void intel_print_wm_latency(struct drm_i915_private *dev_priv, + const char *name, +- const u16 wm[8]) ++ const u16 wm[]) + { + int level, max_level = ilk_wm_max_level(dev_priv); + +--- a/drivers/media/usb/dvb-usb/dvb-usb.h ++++ b/drivers/media/usb/dvb-usb/dvb-usb.h +@@ -485,7 +485,7 @@ extern int __must_check + dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16); + + /* commonly used remote control parsing */ +-extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *); ++extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[5], u32 *, int *); + + /* commonly used firmware download types and function */ + struct hexline { +--- a/include/scsi/libfcoe.h ++++ b/include/scsi/libfcoe.h +@@ -249,7 +249,7 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctl + struct fc_frame *); + + /* libfcoe funcs */ +-u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); ++u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], unsigned int, unsigned int); + int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *, + const struct libfc_function_template *, int init_fcp); + u32 fcoe_fc_crc(struct fc_frame *fp); +--- a/net/bluetooth/ecdh_helper.h ++++ b/net/bluetooth/ecdh_helper.h +@@ -25,6 +25,6 @@ + + int compute_ecdh_secret(struct crypto_kpp *tfm, const u8 pair_public_key[64], + u8 secret[32]); +-int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 *private_key); ++int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 private_key[32]); + int generate_ecdh_public_key(struct crypto_kpp *tfm, u8 public_key[64]); + int generate_ecdh_keys(struct crypto_kpp *tfm, u8 public_key[64]); diff --git a/queue-5.4/security-commoncap-fix-wstringop-overread-warning.patch b/queue-5.4/security-commoncap-fix-wstringop-overread-warning.patch new file mode 100644 index 00000000000..d9eb9b3a3ce --- /dev/null +++ b/queue-5.4/security-commoncap-fix-wstringop-overread-warning.patch @@ -0,0 +1,46 @@ +From 82e5d8cc768b0c7b03c551a9ab1f8f3f68d5f83f Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 22 Mar 2021 17:02:41 +0100 +Subject: security: commoncap: fix -Wstringop-overread warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Arnd Bergmann + +commit 82e5d8cc768b0c7b03c551a9ab1f8f3f68d5f83f upstream. + +gcc-11 introdces a harmless warning for cap_inode_getsecurity: + +security/commoncap.c: In function ‘cap_inode_getsecurity’: +security/commoncap.c:440:33: error: ‘memcpy’ reading 16 bytes from a region of size 0 [-Werror=stringop-overread] + 440 | memcpy(&nscap->data, &cap->data, sizeof(__le32) * 2 * VFS_CAP_U32); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The problem here is that tmpbuf is initialized to NULL, so gcc assumes +it is not accessible unless it gets set by vfs_getxattr_alloc(). This is +a legitimate warning as far as I can tell, but the code is correct since +it correctly handles the error when that function fails. + +Add a separate NULL check to tell gcc about it as well. + +Signed-off-by: Arnd Bergmann +Acked-by: Christian Brauner +Signed-off-by: James Morris +Cc: Andrey Zhizhikin +Signed-off-by: Greg Kroah-Hartman +--- + security/commoncap.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/security/commoncap.c ++++ b/security/commoncap.c +@@ -391,7 +391,7 @@ int cap_inode_getsecurity(struct inode * + &tmpbuf, size, GFP_NOFS); + dput(dentry); + +- if (ret < 0) ++ if (ret < 0 || !tmpbuf) + return ret; + + fs_ns = inode->i_sb->s_user_ns; diff --git a/queue-5.4/series b/queue-5.4/series index 188d128df2f..34326adbbd5 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -154,3 +154,5 @@ crypto-rng-fix-crypto_rng_reset-refcounting-when-crypto_stats.patch md-raid1-properly-indicate-failure-when-ending-a-failed-write-request.patch dm-raid-fix-inconclusive-reshape-layout-on-fast-raid4-5-6-table-reload-sequences.patch fuse-fix-write-deadlock.patch +security-commoncap-fix-wstringop-overread-warning.patch +fix-misc-new-gcc-warnings.patch -- 2.47.3