Patch "mmc: sunxi: avoid invalid pointer calculation" has been added to the 3.18-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
mmc: sunxi: avoid invalid pointer calculation
to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mmc-sunxi-avoid-invalid-pointer-calculation.patch
and it can be found in the queue-3.18 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
d34712d2e3db9b241d0484a6e3839c6b7ef9df78Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Tue, 24 Feb 2015 10:47:27 +0100
Subject: mmc: sunxi: avoid invalid pointer calculation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Arnd Bergmann <[email protected]>
commit d34712d2e3db9b241d0484a6e3839c6b7ef9df78 upstream.
The sunxi mmc driver tries to calculate a dma address by using pointer arithmetic, which causes a warning when dma_addr_t is wider than a pointer:
drivers/mmc/host/sunxi-mmc.c: In function 'sunxi_mmc_init_idma_des':drivers/mmc/host/sunxi-mmc.c:296:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
struct sunxi_idma_des *pdes_pa = (struct sunxi_idma_des *)host->sg_dma;
^To avoid this warning and to simplify the logic, this changes the code to avoid the cast and calculate the correct address manually. The behavior should be unchanged.
--- drivers/mmc/host/sunxi-mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/sunxi-mmc.c +3 -2
@@ -294,7 +294,7 @@ static void sunxi_mmc_init_idma_des(stru struct mmc_data *data) {struct sunxi_idma_des *pdes = (struct sunxi_idma_des *)host->sg_cpu; -struct sunxi_idma_des *pdes_pa = (struct sunxi_idma_des *)host->sg_dma; +dma_addr_t next_desc = host->sg_dma;int i, max_len = (1 << host->idma_des_size_bits);for (i =0 ; i < data->sg_len; i++) {
@@ -306,8 +306,9 @@ static void sunxi_mmc_init_idma_des(struelse pdes[i].buf_size = data->sg[i].length; + next_desc +=sizeof (struct sunxi_idma_des ); pdes[i].buf_addr_ptr1 =sg_dma_address (&data->sg[i]); - pdes[i].buf_addr_ptr2 = (u32)&pdes_pa[i +1 ]; + pdes[i].buf_addr_ptr2 = (u32 )next_desc; } pdes[0 ].config |=SDXC_IDMAC_DES0_FD ;
Patches currently in stable-queue which might be from [email protected] are
queue-3.18/net-vxge-avoid-unused-function-warnings.patch queue-3.18/tty-nozomi-avoid-a-harmless-gcc-warning.patch queue-3.18/perf-avoid-horrible-stack-usage.patch queue-3.18/btrfs-fix-state-private-cast-on-32-bit-machines.patch queue-3.18/mm-init-fix-zone-boundary-creation.patch queue-3.18/iommu-vt-d-remove-unused-variable.patch queue-3.18/mips-msp71xx-remove-odd-locking-in-pci-config-space-access-code.patch queue-3.18/net-tulip-turn-compile-time-warning-into-dev_warn.patch queue-3.18/nfsd-work-around-a-gcc-5.1-warning.patch queue-3.18/fs-nfs-fix-new-compiler-warning-about-boolean-in-switch.patch queue-3.18/aic94xx-skip-reading-user-settings-if-flash-is-not-found.patch queue-3.18/mmc-sunxi-avoid-invalid-pointer-calculation.patch queue-3.18/acpi-power-avoid-maybe-uninitialized-warning.patch queue-3.18/gfs2-avoid-uninitialized-variable-warning.patch queue-3.18/gadgetfs-fix-uninitialized-variable-in-error-handling.patch queue-3.18/arm-8296-1-cache-l2x0-clean-up-aurora-cache-handling.patch queue-3.18/brcmfmac-avoid-gcc-5.1-warning.patch queue-3.18/kconfig-tinyconfig-provide-whole-choice-blocks-to-avoid-warnings.patch queue-3.18/net-ti-cpmac-fix-compiler-warning-due-to-type-confusion.patch queue-3.18/clk-at91-usb-fix-determine_rate-prototype-again.patch queue-3.18/mips-ralink-cosmetic-change-to-prom_init.patch queue-3.18/mips-fix-the-build-on-jz4740-after-removing-the-custom-gpio.h.patch queue-3.18/mips-asm-compiler-add-new-macros-to-set-isa-and-arch-asm-annotations.patch queue-3.18/misc-ioc4-simplify-wave-period-measurement-in-clock_calibrate.patch queue-3.18/hostap-avoid-uninitialized-variable-use-in-hfa384x_get_rid.patch queue-3.18/dm-bufio-hide-bogus-warning.patch queue-3.18/fix-signed-unsigned-pointer-warning.patch