From: Sasha Levin Date: Fri, 21 Feb 2020 15:54:49 +0000 (-0500) Subject: Drop soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch X-Git-Tag: v4.19.106~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=76be2ca16aa864b2f22eca9132ecf12ba3c8b5a6;p=thirdparty%2Fkernel%2Fstable-queue.git Drop soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/series b/queue-4.14/series index 96a5172ac80..1373ad8c050 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -32,7 +32,6 @@ revert-kvm-vmx-add-non-canonical-check-on-writes-to-.patch kvm-nvmx-use-correct-root-level-for-nested-ept-shado.patch drm-gma500-fixup-fbdev-stolen-size-usage-evaluation.patch nfsd4-avoid-null-deference-on-strange-copy-compounds.patch -soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch cpu-hotplug-stop_machine-fix-stop_machine-vs-hotplug.patch brcmfmac-fix-use-after-free-in-brcmf_sdio_readframes.patch leds-pca963x-fix-open-drain-initialization.patch diff --git a/queue-4.14/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch b/queue-4.14/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch deleted file mode 100644 index 9ce362ac73e..00000000000 --- a/queue-4.14/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch +++ /dev/null @@ -1,188 +0,0 @@ -From 81b703fc72b9c63a53ea46d8e01356cca3f69cf6 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 28 Nov 2019 15:55:40 +0100 -Subject: soc: fsl: qe: change return type of cpm_muram_alloc() to s32 - -From: Rasmus Villemoes - -[ Upstream commit 800cd6fb76f0ec7711deb72a86c924db1ae42648 ] - -There are a number of problems with cpm_muram_alloc() and its -callers. Most callers assign the return value to some variable and -then use IS_ERR_VALUE to check for allocation failure. However, when -that variable is not sizeof(long), this leads to warnings - and it is -indeed broken to do e.g. - - u32 foo = cpm_muram_alloc(); - if (IS_ERR_VALUE(foo)) - -on a 64-bit platform, since the condition - - foo >= (unsigned long)-ENOMEM - -is tautologically false. There are also callers that ignore the -possibility of error, and then there are those that check for error by -comparing the return value to 0... - -One could fix that by changing all callers to store the return value -temporarily in an "unsigned long" and test that. However, use of -IS_ERR_VALUE() is error-prone and should be restricted to things which -are inherently long-sized (stuff in pt_regs etc.). Instead, let's aim -for changing to the standard kernel style - - int foo = cpm_muram_alloc(); - if (foo < 0) - deal_with_it() - some->where = foo; - -Changing the return type from unsigned long to s32 (aka signed int) -doesn't change the value that gets stored into any of the callers' -variables except if the caller was storing the result in a u64 _and_ -the allocation failed, so in itself this patch should be a no-op. - -Another problem with cpm_muram_alloc() is that it can certainly -validly return 0 - and except if some cpm_muram_alloc_fixed() call -interferes, the very first cpm_muram_alloc() call will return just -that. But that shows that both ucc_slow_free() and ucc_fast_free() are -buggy, since they assume that a value of 0 means "that field was never -allocated". We'll later change cpm_muram_free() to accept (and ignore) -a negative offset, so callers can use a sentinel of -1 instead of 0 -and just unconditionally call cpm_muram_free(). - -Reviewed-by: Timur Tabi -Signed-off-by: Rasmus Villemoes -Signed-off-by: Li Yang -Signed-off-by: Sasha Levin ---- - drivers/soc/fsl/qe/qe_common.c | 29 ++++++++++++++++------------- - include/soc/fsl/qe/qe.h | 16 ++++++++-------- - 2 files changed, 24 insertions(+), 21 deletions(-) - -diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c -index 104e68d9b84f2..4f60724b06b7c 100644 ---- a/drivers/soc/fsl/qe/qe_common.c -+++ b/drivers/soc/fsl/qe/qe_common.c -@@ -35,7 +35,7 @@ static phys_addr_t muram_pbase; - - struct muram_block { - struct list_head head; -- unsigned long start; -+ s32 start; - int size; - }; - -@@ -113,13 +113,14 @@ out_muram: - * @algo: algorithm for alloc. - * @data: data for genalloc's algorithm. - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - */ --static unsigned long cpm_muram_alloc_common(unsigned long size, -- genpool_algo_t algo, void *data) -+static s32 cpm_muram_alloc_common(unsigned long size, -+ genpool_algo_t algo, void *data) - { - struct muram_block *entry; -- unsigned long start; -+ s32 start; - - if (!muram_pool && cpm_muram_init()) - goto out2; -@@ -140,7 +141,7 @@ static unsigned long cpm_muram_alloc_common(unsigned long size, - out1: - gen_pool_free(muram_pool, start, size); - out2: -- return (unsigned long)-ENOMEM; -+ return -ENOMEM; - } - - /* -@@ -148,13 +149,14 @@ out2: - * @size: number of bytes to allocate - * @align: requested alignment, in bytes - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align) -+s32 cpm_muram_alloc(unsigned long size, unsigned long align) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_align muram_pool_data; - -@@ -171,7 +173,7 @@ EXPORT_SYMBOL(cpm_muram_alloc); - * cpm_muram_free - free a chunk of multi-user ram - * @offset: The beginning of the chunk as returned by cpm_muram_alloc(). - */ --int cpm_muram_free(unsigned long offset) -+int cpm_muram_free(s32 offset) - { - unsigned long flags; - int size; -@@ -197,13 +199,14 @@ EXPORT_SYMBOL(cpm_muram_free); - * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram - * @offset: offset of allocation start address - * @size: number of bytes to allocate -- * This function returns an offset into the muram area -+ * This function returns @offset if the area was available, a negative -+ * errno otherwise. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_fixed muram_pool_data_fixed; - -diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h -index b3d1aff5e8ad5..deb6238416947 100644 ---- a/include/soc/fsl/qe/qe.h -+++ b/include/soc/fsl/qe/qe.h -@@ -102,26 +102,26 @@ static inline void qe_reset(void) {} - int cpm_muram_init(void); - - #if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); --int cpm_muram_free(unsigned long offset); --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); -+s32 cpm_muram_alloc(unsigned long size, unsigned long align); -+int cpm_muram_free(s32 offset); -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); - void __iomem *cpm_muram_addr(unsigned long offset); - unsigned long cpm_muram_offset(void __iomem *addr); - dma_addr_t cpm_muram_dma(void __iomem *addr); - #else --static inline unsigned long cpm_muram_alloc(unsigned long size, -- unsigned long align) -+static inline s32 cpm_muram_alloc(unsigned long size, -+ unsigned long align) - { - return -ENOSYS; - } - --static inline int cpm_muram_free(unsigned long offset) -+static inline int cpm_muram_free(s32 offset) - { - return -ENOSYS; - } - --static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset, -- unsigned long size) -+static inline s32 cpm_muram_alloc_fixed(unsigned long offset, -+ unsigned long size) - { - return -ENOSYS; - } --- -2.20.1 - diff --git a/queue-4.19/series b/queue-4.19/series index 687667fc906..01ee2e0b391 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -9,7 +9,6 @@ revert-kvm-vmx-add-non-canonical-check-on-writes-to-.patch kvm-nvmx-use-correct-root-level-for-nested-ept-shado.patch drm-gma500-fixup-fbdev-stolen-size-usage-evaluation.patch nfsd4-avoid-null-deference-on-strange-copy-compounds.patch -soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch cpu-hotplug-stop_machine-fix-stop_machine-vs-hotplug.patch brcmfmac-fix-use-after-free-in-brcmf_sdio_readframes.patch leds-pca963x-fix-open-drain-initialization.patch diff --git a/queue-4.19/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch b/queue-4.19/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch deleted file mode 100644 index c70e1705fb6..00000000000 --- a/queue-4.19/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch +++ /dev/null @@ -1,188 +0,0 @@ -From e766160fc3817ce0d3ef35e29dfaf66555bcfb0d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 28 Nov 2019 15:55:40 +0100 -Subject: soc: fsl: qe: change return type of cpm_muram_alloc() to s32 - -From: Rasmus Villemoes - -[ Upstream commit 800cd6fb76f0ec7711deb72a86c924db1ae42648 ] - -There are a number of problems with cpm_muram_alloc() and its -callers. Most callers assign the return value to some variable and -then use IS_ERR_VALUE to check for allocation failure. However, when -that variable is not sizeof(long), this leads to warnings - and it is -indeed broken to do e.g. - - u32 foo = cpm_muram_alloc(); - if (IS_ERR_VALUE(foo)) - -on a 64-bit platform, since the condition - - foo >= (unsigned long)-ENOMEM - -is tautologically false. There are also callers that ignore the -possibility of error, and then there are those that check for error by -comparing the return value to 0... - -One could fix that by changing all callers to store the return value -temporarily in an "unsigned long" and test that. However, use of -IS_ERR_VALUE() is error-prone and should be restricted to things which -are inherently long-sized (stuff in pt_regs etc.). Instead, let's aim -for changing to the standard kernel style - - int foo = cpm_muram_alloc(); - if (foo < 0) - deal_with_it() - some->where = foo; - -Changing the return type from unsigned long to s32 (aka signed int) -doesn't change the value that gets stored into any of the callers' -variables except if the caller was storing the result in a u64 _and_ -the allocation failed, so in itself this patch should be a no-op. - -Another problem with cpm_muram_alloc() is that it can certainly -validly return 0 - and except if some cpm_muram_alloc_fixed() call -interferes, the very first cpm_muram_alloc() call will return just -that. But that shows that both ucc_slow_free() and ucc_fast_free() are -buggy, since they assume that a value of 0 means "that field was never -allocated". We'll later change cpm_muram_free() to accept (and ignore) -a negative offset, so callers can use a sentinel of -1 instead of 0 -and just unconditionally call cpm_muram_free(). - -Reviewed-by: Timur Tabi -Signed-off-by: Rasmus Villemoes -Signed-off-by: Li Yang -Signed-off-by: Sasha Levin ---- - drivers/soc/fsl/qe/qe_common.c | 29 ++++++++++++++++------------- - include/soc/fsl/qe/qe.h | 16 ++++++++-------- - 2 files changed, 24 insertions(+), 21 deletions(-) - -diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c -index 104e68d9b84f2..4f60724b06b7c 100644 ---- a/drivers/soc/fsl/qe/qe_common.c -+++ b/drivers/soc/fsl/qe/qe_common.c -@@ -35,7 +35,7 @@ static phys_addr_t muram_pbase; - - struct muram_block { - struct list_head head; -- unsigned long start; -+ s32 start; - int size; - }; - -@@ -113,13 +113,14 @@ out_muram: - * @algo: algorithm for alloc. - * @data: data for genalloc's algorithm. - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - */ --static unsigned long cpm_muram_alloc_common(unsigned long size, -- genpool_algo_t algo, void *data) -+static s32 cpm_muram_alloc_common(unsigned long size, -+ genpool_algo_t algo, void *data) - { - struct muram_block *entry; -- unsigned long start; -+ s32 start; - - if (!muram_pool && cpm_muram_init()) - goto out2; -@@ -140,7 +141,7 @@ static unsigned long cpm_muram_alloc_common(unsigned long size, - out1: - gen_pool_free(muram_pool, start, size); - out2: -- return (unsigned long)-ENOMEM; -+ return -ENOMEM; - } - - /* -@@ -148,13 +149,14 @@ out2: - * @size: number of bytes to allocate - * @align: requested alignment, in bytes - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align) -+s32 cpm_muram_alloc(unsigned long size, unsigned long align) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_align muram_pool_data; - -@@ -171,7 +173,7 @@ EXPORT_SYMBOL(cpm_muram_alloc); - * cpm_muram_free - free a chunk of multi-user ram - * @offset: The beginning of the chunk as returned by cpm_muram_alloc(). - */ --int cpm_muram_free(unsigned long offset) -+int cpm_muram_free(s32 offset) - { - unsigned long flags; - int size; -@@ -197,13 +199,14 @@ EXPORT_SYMBOL(cpm_muram_free); - * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram - * @offset: offset of allocation start address - * @size: number of bytes to allocate -- * This function returns an offset into the muram area -+ * This function returns @offset if the area was available, a negative -+ * errno otherwise. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_fixed muram_pool_data_fixed; - -diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h -index b3d1aff5e8ad5..deb6238416947 100644 ---- a/include/soc/fsl/qe/qe.h -+++ b/include/soc/fsl/qe/qe.h -@@ -102,26 +102,26 @@ static inline void qe_reset(void) {} - int cpm_muram_init(void); - - #if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); --int cpm_muram_free(unsigned long offset); --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); -+s32 cpm_muram_alloc(unsigned long size, unsigned long align); -+int cpm_muram_free(s32 offset); -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); - void __iomem *cpm_muram_addr(unsigned long offset); - unsigned long cpm_muram_offset(void __iomem *addr); - dma_addr_t cpm_muram_dma(void __iomem *addr); - #else --static inline unsigned long cpm_muram_alloc(unsigned long size, -- unsigned long align) -+static inline s32 cpm_muram_alloc(unsigned long size, -+ unsigned long align) - { - return -ENOSYS; - } - --static inline int cpm_muram_free(unsigned long offset) -+static inline int cpm_muram_free(s32 offset) - { - return -ENOSYS; - } - --static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset, -- unsigned long size) -+static inline s32 cpm_muram_alloc_fixed(unsigned long offset, -+ unsigned long size) - { - return -ENOSYS; - } --- -2.20.1 - diff --git a/queue-4.9/series b/queue-4.9/series index 4e5b3777e98..381fc834cc6 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -16,7 +16,6 @@ scsi-qla2xxx-fix-a-potential-null-pointer-dereference.patch revert-kvm-vmx-add-non-canonical-check-on-writes-to-.patch drm-gma500-fixup-fbdev-stolen-size-usage-evaluation.patch nfsd4-avoid-null-deference-on-strange-copy-compounds.patch -soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch cpu-hotplug-stop_machine-fix-stop_machine-vs-hotplug.patch brcmfmac-fix-use-after-free-in-brcmf_sdio_readframes.patch gianfar-fix-tx-timestamping-with-a-stacked-dsa-drive.patch diff --git a/queue-4.9/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch b/queue-4.9/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch deleted file mode 100644 index a125affe585..00000000000 --- a/queue-4.9/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch +++ /dev/null @@ -1,188 +0,0 @@ -From 5e1f645c0954e355aa4c68359f761494fb755a36 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 28 Nov 2019 15:55:40 +0100 -Subject: soc: fsl: qe: change return type of cpm_muram_alloc() to s32 - -From: Rasmus Villemoes - -[ Upstream commit 800cd6fb76f0ec7711deb72a86c924db1ae42648 ] - -There are a number of problems with cpm_muram_alloc() and its -callers. Most callers assign the return value to some variable and -then use IS_ERR_VALUE to check for allocation failure. However, when -that variable is not sizeof(long), this leads to warnings - and it is -indeed broken to do e.g. - - u32 foo = cpm_muram_alloc(); - if (IS_ERR_VALUE(foo)) - -on a 64-bit platform, since the condition - - foo >= (unsigned long)-ENOMEM - -is tautologically false. There are also callers that ignore the -possibility of error, and then there are those that check for error by -comparing the return value to 0... - -One could fix that by changing all callers to store the return value -temporarily in an "unsigned long" and test that. However, use of -IS_ERR_VALUE() is error-prone and should be restricted to things which -are inherently long-sized (stuff in pt_regs etc.). Instead, let's aim -for changing to the standard kernel style - - int foo = cpm_muram_alloc(); - if (foo < 0) - deal_with_it() - some->where = foo; - -Changing the return type from unsigned long to s32 (aka signed int) -doesn't change the value that gets stored into any of the callers' -variables except if the caller was storing the result in a u64 _and_ -the allocation failed, so in itself this patch should be a no-op. - -Another problem with cpm_muram_alloc() is that it can certainly -validly return 0 - and except if some cpm_muram_alloc_fixed() call -interferes, the very first cpm_muram_alloc() call will return just -that. But that shows that both ucc_slow_free() and ucc_fast_free() are -buggy, since they assume that a value of 0 means "that field was never -allocated". We'll later change cpm_muram_free() to accept (and ignore) -a negative offset, so callers can use a sentinel of -1 instead of 0 -and just unconditionally call cpm_muram_free(). - -Reviewed-by: Timur Tabi -Signed-off-by: Rasmus Villemoes -Signed-off-by: Li Yang -Signed-off-by: Sasha Levin ---- - drivers/soc/fsl/qe/qe_common.c | 29 ++++++++++++++++------------- - include/soc/fsl/qe/qe.h | 16 ++++++++-------- - 2 files changed, 24 insertions(+), 21 deletions(-) - -diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c -index 104e68d9b84f2..4f60724b06b7c 100644 ---- a/drivers/soc/fsl/qe/qe_common.c -+++ b/drivers/soc/fsl/qe/qe_common.c -@@ -35,7 +35,7 @@ static phys_addr_t muram_pbase; - - struct muram_block { - struct list_head head; -- unsigned long start; -+ s32 start; - int size; - }; - -@@ -113,13 +113,14 @@ out_muram: - * @algo: algorithm for alloc. - * @data: data for genalloc's algorithm. - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - */ --static unsigned long cpm_muram_alloc_common(unsigned long size, -- genpool_algo_t algo, void *data) -+static s32 cpm_muram_alloc_common(unsigned long size, -+ genpool_algo_t algo, void *data) - { - struct muram_block *entry; -- unsigned long start; -+ s32 start; - - if (!muram_pool && cpm_muram_init()) - goto out2; -@@ -140,7 +141,7 @@ static unsigned long cpm_muram_alloc_common(unsigned long size, - out1: - gen_pool_free(muram_pool, start, size); - out2: -- return (unsigned long)-ENOMEM; -+ return -ENOMEM; - } - - /* -@@ -148,13 +149,14 @@ out2: - * @size: number of bytes to allocate - * @align: requested alignment, in bytes - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align) -+s32 cpm_muram_alloc(unsigned long size, unsigned long align) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_align muram_pool_data; - -@@ -171,7 +173,7 @@ EXPORT_SYMBOL(cpm_muram_alloc); - * cpm_muram_free - free a chunk of multi-user ram - * @offset: The beginning of the chunk as returned by cpm_muram_alloc(). - */ --int cpm_muram_free(unsigned long offset) -+int cpm_muram_free(s32 offset) - { - unsigned long flags; - int size; -@@ -197,13 +199,14 @@ EXPORT_SYMBOL(cpm_muram_free); - * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram - * @offset: offset of allocation start address - * @size: number of bytes to allocate -- * This function returns an offset into the muram area -+ * This function returns @offset if the area was available, a negative -+ * errno otherwise. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_fixed muram_pool_data_fixed; - -diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h -index 226f915a68c28..55907f7ace82e 100644 ---- a/include/soc/fsl/qe/qe.h -+++ b/include/soc/fsl/qe/qe.h -@@ -102,26 +102,26 @@ static inline void qe_reset(void) {} - int cpm_muram_init(void); - - #if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); --int cpm_muram_free(unsigned long offset); --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); -+s32 cpm_muram_alloc(unsigned long size, unsigned long align); -+int cpm_muram_free(s32 offset); -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); - void __iomem *cpm_muram_addr(unsigned long offset); - unsigned long cpm_muram_offset(void __iomem *addr); - dma_addr_t cpm_muram_dma(void __iomem *addr); - #else --static inline unsigned long cpm_muram_alloc(unsigned long size, -- unsigned long align) -+static inline s32 cpm_muram_alloc(unsigned long size, -+ unsigned long align) - { - return -ENOSYS; - } - --static inline int cpm_muram_free(unsigned long offset) -+static inline int cpm_muram_free(s32 offset) - { - return -ENOSYS; - } - --static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset, -- unsigned long size) -+static inline s32 cpm_muram_alloc_fixed(unsigned long offset, -+ unsigned long size) - { - return -ENOSYS; - } --- -2.20.1 - diff --git a/queue-5.4/series b/queue-5.4/series index 2953b05042b..d489b6c5199 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -11,7 +11,6 @@ drm-qxl-complete-exception-handling-in-qxl_device_in.patch nfsd4-avoid-null-deference-on-strange-copy-compounds.patch rcu-nocb-fix-dump_tree-hierarchy-print-always-active.patch rcu-fix-missed-wakeup-of-exp_wq-waiters.patch -soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch rcu-fix-data-race-due-to-atomic_t-copy-by-value.patch f2fs-preallocate-dio-blocks-when-forcing-buffered_io.patch f2fs-call-f2fs_balance_fs-outside-of-locked-page.patch diff --git a/queue-5.4/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch b/queue-5.4/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch deleted file mode 100644 index f4c50f7f42d..00000000000 --- a/queue-5.4/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch +++ /dev/null @@ -1,188 +0,0 @@ -From a621d4c881759e096736128064ac81d02aedb1e5 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 28 Nov 2019 15:55:40 +0100 -Subject: soc: fsl: qe: change return type of cpm_muram_alloc() to s32 - -From: Rasmus Villemoes - -[ Upstream commit 800cd6fb76f0ec7711deb72a86c924db1ae42648 ] - -There are a number of problems with cpm_muram_alloc() and its -callers. Most callers assign the return value to some variable and -then use IS_ERR_VALUE to check for allocation failure. However, when -that variable is not sizeof(long), this leads to warnings - and it is -indeed broken to do e.g. - - u32 foo = cpm_muram_alloc(); - if (IS_ERR_VALUE(foo)) - -on a 64-bit platform, since the condition - - foo >= (unsigned long)-ENOMEM - -is tautologically false. There are also callers that ignore the -possibility of error, and then there are those that check for error by -comparing the return value to 0... - -One could fix that by changing all callers to store the return value -temporarily in an "unsigned long" and test that. However, use of -IS_ERR_VALUE() is error-prone and should be restricted to things which -are inherently long-sized (stuff in pt_regs etc.). Instead, let's aim -for changing to the standard kernel style - - int foo = cpm_muram_alloc(); - if (foo < 0) - deal_with_it() - some->where = foo; - -Changing the return type from unsigned long to s32 (aka signed int) -doesn't change the value that gets stored into any of the callers' -variables except if the caller was storing the result in a u64 _and_ -the allocation failed, so in itself this patch should be a no-op. - -Another problem with cpm_muram_alloc() is that it can certainly -validly return 0 - and except if some cpm_muram_alloc_fixed() call -interferes, the very first cpm_muram_alloc() call will return just -that. But that shows that both ucc_slow_free() and ucc_fast_free() are -buggy, since they assume that a value of 0 means "that field was never -allocated". We'll later change cpm_muram_free() to accept (and ignore) -a negative offset, so callers can use a sentinel of -1 instead of 0 -and just unconditionally call cpm_muram_free(). - -Reviewed-by: Timur Tabi -Signed-off-by: Rasmus Villemoes -Signed-off-by: Li Yang -Signed-off-by: Sasha Levin ---- - drivers/soc/fsl/qe/qe_common.c | 29 ++++++++++++++++------------- - include/soc/fsl/qe/qe.h | 16 ++++++++-------- - 2 files changed, 24 insertions(+), 21 deletions(-) - -diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c -index 83e85e61669f5..84c90105e588b 100644 ---- a/drivers/soc/fsl/qe/qe_common.c -+++ b/drivers/soc/fsl/qe/qe_common.c -@@ -32,7 +32,7 @@ static phys_addr_t muram_pbase; - - struct muram_block { - struct list_head head; -- unsigned long start; -+ s32 start; - int size; - }; - -@@ -110,13 +110,14 @@ out_muram: - * @algo: algorithm for alloc. - * @data: data for genalloc's algorithm. - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - */ --static unsigned long cpm_muram_alloc_common(unsigned long size, -- genpool_algo_t algo, void *data) -+static s32 cpm_muram_alloc_common(unsigned long size, -+ genpool_algo_t algo, void *data) - { - struct muram_block *entry; -- unsigned long start; -+ s32 start; - - if (!muram_pool && cpm_muram_init()) - goto out2; -@@ -137,7 +138,7 @@ static unsigned long cpm_muram_alloc_common(unsigned long size, - out1: - gen_pool_free(muram_pool, start, size); - out2: -- return (unsigned long)-ENOMEM; -+ return -ENOMEM; - } - - /* -@@ -145,13 +146,14 @@ out2: - * @size: number of bytes to allocate - * @align: requested alignment, in bytes - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align) -+s32 cpm_muram_alloc(unsigned long size, unsigned long align) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_align muram_pool_data; - -@@ -168,7 +170,7 @@ EXPORT_SYMBOL(cpm_muram_alloc); - * cpm_muram_free - free a chunk of multi-user ram - * @offset: The beginning of the chunk as returned by cpm_muram_alloc(). - */ --int cpm_muram_free(unsigned long offset) -+int cpm_muram_free(s32 offset) - { - unsigned long flags; - int size; -@@ -194,13 +196,14 @@ EXPORT_SYMBOL(cpm_muram_free); - * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram - * @offset: offset of allocation start address - * @size: number of bytes to allocate -- * This function returns an offset into the muram area -+ * This function returns @offset if the area was available, a negative -+ * errno otherwise. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_fixed muram_pool_data_fixed; - -diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h -index c1036d16ed03b..2d35d5db16231 100644 ---- a/include/soc/fsl/qe/qe.h -+++ b/include/soc/fsl/qe/qe.h -@@ -98,26 +98,26 @@ static inline void qe_reset(void) {} - int cpm_muram_init(void); - - #if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); --int cpm_muram_free(unsigned long offset); --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); -+s32 cpm_muram_alloc(unsigned long size, unsigned long align); -+int cpm_muram_free(s32 offset); -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); - void __iomem *cpm_muram_addr(unsigned long offset); - unsigned long cpm_muram_offset(void __iomem *addr); - dma_addr_t cpm_muram_dma(void __iomem *addr); - #else --static inline unsigned long cpm_muram_alloc(unsigned long size, -- unsigned long align) -+static inline s32 cpm_muram_alloc(unsigned long size, -+ unsigned long align) - { - return -ENOSYS; - } - --static inline int cpm_muram_free(unsigned long offset) -+static inline int cpm_muram_free(s32 offset) - { - return -ENOSYS; - } - --static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset, -- unsigned long size) -+static inline s32 cpm_muram_alloc_fixed(unsigned long offset, -+ unsigned long size) - { - return -ENOSYS; - } --- -2.20.1 - diff --git a/queue-5.5/series b/queue-5.5/series index 7b0700d8503..060260fd7eb 100644 --- a/queue-5.5/series +++ b/queue-5.5/series @@ -13,7 +13,6 @@ drm-qxl-complete-exception-handling-in-qxl_device_in.patch nfsd4-avoid-null-deference-on-strange-copy-compounds.patch rcu-nocb-fix-dump_tree-hierarchy-print-always-active.patch rcu-fix-missed-wakeup-of-exp_wq-waiters.patch -soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch rcu-fix-data-race-due-to-atomic_t-copy-by-value.patch dmaengine-ti-edma-add-missed-operations.patch f2fs-preallocate-dio-blocks-when-forcing-buffered_io.patch diff --git a/queue-5.5/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch b/queue-5.5/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch deleted file mode 100644 index 0af2f255784..00000000000 --- a/queue-5.5/soc-fsl-qe-change-return-type-of-cpm_muram_alloc-to-.patch +++ /dev/null @@ -1,188 +0,0 @@ -From bb2933e84815dcc39d555f2746ffef8665dddbc8 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 28 Nov 2019 15:55:40 +0100 -Subject: soc: fsl: qe: change return type of cpm_muram_alloc() to s32 - -From: Rasmus Villemoes - -[ Upstream commit 800cd6fb76f0ec7711deb72a86c924db1ae42648 ] - -There are a number of problems with cpm_muram_alloc() and its -callers. Most callers assign the return value to some variable and -then use IS_ERR_VALUE to check for allocation failure. However, when -that variable is not sizeof(long), this leads to warnings - and it is -indeed broken to do e.g. - - u32 foo = cpm_muram_alloc(); - if (IS_ERR_VALUE(foo)) - -on a 64-bit platform, since the condition - - foo >= (unsigned long)-ENOMEM - -is tautologically false. There are also callers that ignore the -possibility of error, and then there are those that check for error by -comparing the return value to 0... - -One could fix that by changing all callers to store the return value -temporarily in an "unsigned long" and test that. However, use of -IS_ERR_VALUE() is error-prone and should be restricted to things which -are inherently long-sized (stuff in pt_regs etc.). Instead, let's aim -for changing to the standard kernel style - - int foo = cpm_muram_alloc(); - if (foo < 0) - deal_with_it() - some->where = foo; - -Changing the return type from unsigned long to s32 (aka signed int) -doesn't change the value that gets stored into any of the callers' -variables except if the caller was storing the result in a u64 _and_ -the allocation failed, so in itself this patch should be a no-op. - -Another problem with cpm_muram_alloc() is that it can certainly -validly return 0 - and except if some cpm_muram_alloc_fixed() call -interferes, the very first cpm_muram_alloc() call will return just -that. But that shows that both ucc_slow_free() and ucc_fast_free() are -buggy, since they assume that a value of 0 means "that field was never -allocated". We'll later change cpm_muram_free() to accept (and ignore) -a negative offset, so callers can use a sentinel of -1 instead of 0 -and just unconditionally call cpm_muram_free(). - -Reviewed-by: Timur Tabi -Signed-off-by: Rasmus Villemoes -Signed-off-by: Li Yang -Signed-off-by: Sasha Levin ---- - drivers/soc/fsl/qe/qe_common.c | 29 ++++++++++++++++------------- - include/soc/fsl/qe/qe.h | 16 ++++++++-------- - 2 files changed, 24 insertions(+), 21 deletions(-) - -diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c -index 83e85e61669f5..84c90105e588b 100644 ---- a/drivers/soc/fsl/qe/qe_common.c -+++ b/drivers/soc/fsl/qe/qe_common.c -@@ -32,7 +32,7 @@ static phys_addr_t muram_pbase; - - struct muram_block { - struct list_head head; -- unsigned long start; -+ s32 start; - int size; - }; - -@@ -110,13 +110,14 @@ out_muram: - * @algo: algorithm for alloc. - * @data: data for genalloc's algorithm. - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - */ --static unsigned long cpm_muram_alloc_common(unsigned long size, -- genpool_algo_t algo, void *data) -+static s32 cpm_muram_alloc_common(unsigned long size, -+ genpool_algo_t algo, void *data) - { - struct muram_block *entry; -- unsigned long start; -+ s32 start; - - if (!muram_pool && cpm_muram_init()) - goto out2; -@@ -137,7 +138,7 @@ static unsigned long cpm_muram_alloc_common(unsigned long size, - out1: - gen_pool_free(muram_pool, start, size); - out2: -- return (unsigned long)-ENOMEM; -+ return -ENOMEM; - } - - /* -@@ -145,13 +146,14 @@ out2: - * @size: number of bytes to allocate - * @align: requested alignment, in bytes - * -- * This function returns an offset into the muram area. -+ * This function returns a non-negative offset into the muram area, or -+ * a negative errno on failure. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align) -+s32 cpm_muram_alloc(unsigned long size, unsigned long align) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_align muram_pool_data; - -@@ -168,7 +170,7 @@ EXPORT_SYMBOL(cpm_muram_alloc); - * cpm_muram_free - free a chunk of multi-user ram - * @offset: The beginning of the chunk as returned by cpm_muram_alloc(). - */ --int cpm_muram_free(unsigned long offset) -+int cpm_muram_free(s32 offset) - { - unsigned long flags; - int size; -@@ -194,13 +196,14 @@ EXPORT_SYMBOL(cpm_muram_free); - * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram - * @offset: offset of allocation start address - * @size: number of bytes to allocate -- * This function returns an offset into the muram area -+ * This function returns @offset if the area was available, a negative -+ * errno otherwise. - * Use cpm_dpram_addr() to get the virtual address of the area. - * Use cpm_muram_free() to free the allocation. - */ --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) - { -- unsigned long start; -+ s32 start; - unsigned long flags; - struct genpool_data_fixed muram_pool_data_fixed; - -diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h -index c1036d16ed03b..2d35d5db16231 100644 ---- a/include/soc/fsl/qe/qe.h -+++ b/include/soc/fsl/qe/qe.h -@@ -98,26 +98,26 @@ static inline void qe_reset(void) {} - int cpm_muram_init(void); - - #if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) --unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); --int cpm_muram_free(unsigned long offset); --unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); -+s32 cpm_muram_alloc(unsigned long size, unsigned long align); -+int cpm_muram_free(s32 offset); -+s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); - void __iomem *cpm_muram_addr(unsigned long offset); - unsigned long cpm_muram_offset(void __iomem *addr); - dma_addr_t cpm_muram_dma(void __iomem *addr); - #else --static inline unsigned long cpm_muram_alloc(unsigned long size, -- unsigned long align) -+static inline s32 cpm_muram_alloc(unsigned long size, -+ unsigned long align) - { - return -ENOSYS; - } - --static inline int cpm_muram_free(unsigned long offset) -+static inline int cpm_muram_free(s32 offset) - { - return -ENOSYS; - } - --static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset, -- unsigned long size) -+static inline s32 cpm_muram_alloc_fixed(unsigned long offset, -+ unsigned long size) - { - return -ENOSYS; - } --- -2.20.1 -