Quantcast
Channel: Serverphorums.com - Linux Kernel
Viewing all 24115 articles
Browse latest View live

[PATCH] arm64: Remove clk-provider.h include (no replies)

$
0
0
This file doesn't use the clk provider APIs. Remove the include.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

Please ack if you want this to go through the clk-tree (along
with quite a few other patches that do the same thing). Otherwise,
it's fine if it's applied to the arm64 tree.

arch/arm64/kernel/setup.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index f3067d4d4e35..926ae8d9abc5 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -34,7 +34,6 @@
#include <linux/kexec.h>
#include <linux/crash_dump.h>
#include <linux/root_dev.h>
-#include <linux/clk-provider.h>
#include <linux/cpu.h>
#include <linux/interrupt.h>
#include <linux/smp.h>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 1/7] powerpc/512x: clk: Include clk.h (1 reply)

$
0
0
This clock provider uses the consumer API, so include clk.h
explicitly.

Cc: Gerhard Sittig <gsi@denx.de>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

Please ack so this can go through the clk-tree.

arch/powerpc/platforms/512x/clock-commonclk.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/512x/clock-commonclk.c b/arch/powerpc/platforms/512x/clock-commonclk.c
index f691bcabd710..c50ea76ba66c 100644
--- a/arch/powerpc/platforms/512x/clock-commonclk.c
+++ b/arch/powerpc/platforms/512x/clock-commonclk.c
@@ -12,6 +12,7 @@
*/

#include <linux/bitops.h>
+#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/clkdev.h>
#include <linux/device.h>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 2/7] staging: clocking-wizard: Include clk.h (no replies)

$
0
0
This clock provider uses the consumer API, so include clk.h
explicitly.

Cc: Sören Brinkmann <soren.brinkmann@xilinx.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

Please ack so this can go through the clk-tree.

drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c b/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c
index 5455bf3d5a91..b8e2f611fd47 100644
--- a/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c
+++ b/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c
@@ -19,6 +19,7 @@
*/

#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/slab.h>
#include <linux/io.h>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 4/7] clocksource: cadence_ttc: Remove clk-provider.h include (no replies)

$
0
0
This file doesn't use the clk provider APIs. Remove the include.

Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

Please ack if you want this to go through clk-tree, otherwise
it's ok to take it through the clocksource side.

drivers/clocksource/cadence_ttc_timer.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/clocksource/cadence_ttc_timer.c b/drivers/clocksource/cadence_ttc_timer.c
index 510c8a1d37b3..5ea91e3818d0 100644
--- a/drivers/clocksource/cadence_ttc_timer.c
+++ b/drivers/clocksource/cadence_ttc_timer.c
@@ -16,7 +16,6 @@
*/

#include <linux/clk.h>
-#include <linux/clk-provider.h>
#include <linux/interrupt.h>
#include <linux/clockchips.h>
#include <linux/of_address.h>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 5/7] ACPI: Remove clk.h include (no replies)

$
0
0
Clock provider drivers generally shouldn't include clk.h because
it's the consumer API. Remove the includes here because these are
provider drivers.

Cc: Ken Xue <Ken.Xue@amd.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

Please ack so this can go through clk-tree. Otherwise it's ok
to go through the acpi tree.

drivers/acpi/acpi_apd.c | 1 -
drivers/acpi/acpi_lpss.c | 1 -
2 files changed, 2 deletions(-)

diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
index 3984ea96e5f7..a450e7af877c 100644
--- a/drivers/acpi/acpi_apd.c
+++ b/drivers/acpi/acpi_apd.c
@@ -16,7 +16,6 @@
#include <linux/clkdev.h>
#include <linux/acpi.h>
#include <linux/err.h>
-#include <linux/clk.h>
#include <linux/pm.h>

#include "internal.h"
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 569ee090343f..6817b18ed722 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -11,7 +11,6 @@
*/

#include <linux/acpi.h>
-#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/err.h>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 3/7] spi: spi-pxa2xx: Remove clk.h include (no replies)

$
0
0
Clock provider drivers generally shouldn't include clk.h because
it's the consumer API. Remove the include here because this is a
provider driver.

Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

Please ack so this can go through the clk tree. Otherwise
it's ok to go through spi tree.

drivers/spi/spi-pxa2xx-pci.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 3cfd4357489a..d19d7f28aecb 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -7,7 +7,6 @@
#include <linux/of_device.h>
#include <linux/module.h>
#include <linux/spi/pxa2xx_spi.h>
-#include <linux/clk.h>
#include <linux/clk-provider.h>

#include <linux/dmaengine.h>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 0/7] Remove clk.h from clk-provider.h (non-clk drivers part) (2 replies)

$
0
0
This is the second set in a series of patches that removes
clk.h from clk-provider.h. This allows us to clearly see what
provider drivers are using the consumer API (clk.h) by
checking the includes. Currently clk.h is included by
clk-provider.h even though it doesn't need to so quite a few
clk provider drivers are relying on the implicit include.

Cc: Gerhard Sittig <gsi@denx.de>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Sören Brinkmann <soren.brinkmann@xilinx.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Mark Brown <broonie@kernel.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Ken Xue <Ken.Xue@amd.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Luc Verhaegen <libv@skynet.be>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>

Stephen Boyd (7):
powerpc/512x: clk: Include clk.h
staging: clocking-wizard: Include clk.h
spi: spi-pxa2xx: Remove clk.h include
clocksource: cadence_ttc: Remove clk-provider.h include
ACPI: Remove clk.h include
simplefb: Include clk.h
lib/vsprintf.c: Include clk.h

arch/powerpc/platforms/512x/clock-commonclk.c | 1 +
drivers/acpi/acpi_apd.c | 1 -
drivers/acpi/acpi_lpss.c | 1 -
drivers/clocksource/cadence_ttc_timer.c | 1 -
drivers/spi/spi-pxa2xx-pci.c | 1 -
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c | 1 +
drivers/video/fbdev/simplefb.c | 1 +
lib/vsprintf.c | 1 +
8 files changed, 4 insertions(+), 4 deletions(-)

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 00/45] Remove clk.h from clk-provider.h (clk drivers part) (47 replies)

$
0
0
This is the third set in a series of patches that removes
clk.h from clk-provider.h. This allows us to clearly see what
provider drivers are using the consumer API (clk.h) by
checking the includes. Currently clk.h is included by
clk-provider.h even though it doesn't need to, so quite a few
clk provider drivers are relying on the implicit include.

Stephen Boyd (45):
clk: axi-clkgen: Remove clk.h include
clk: cdce706: Include clk.h
clk: clps711x: Remove clk.h include
clk: efm32gg: Remove clk.h include
clk: mux: Remove clk.h include
clk: nomadik: Remove clk.h and clkdev.h includes
clk: palmas: Remove clkdev.h includes
clk: rk808: Remove clk.h include
clk: si5351: Include clk.h
clk: twl6040: Remove clk.h include
clk: u300: Remove clk.h include
clk: wm831x: Remove clk.h include
clk: hisilicon: Remove clk.h include
clk: keystone: Remove clk.h include
clk: mediatek: Properly include clk.h
clk: meson8b: Properly include clk.h
clk: mmp: Remove clk.h include
clk: mvebu: Remove clk.h include
clk: mxs: Include clk.h in C files that use it
clk: nxp: Remove clk.h include
clk: rockchip: Properly include clk.h
clk: samsung: Properly include clk.h and clkdev.h
clk: sirf: Properly include clk.h
clk: socfpga: Remove clk.h and clkdev.h includes
clk: socfpga: Remove clk.h include
clk: tegra: Properly include clk.h
clk: ux500: Remove clk.h and clkdev.h includes
clk: versatile: Remove clk.h and clkdev.h includes
clk: bcm: Include clk.h
clk: highbank: Include clk.h
clk: qcom: Include clk.h
clk: st: Include clk.h
clk: sunxi: Include clk.h
clk: ti: Include clk.h
clk: zynq: Include clk.h
clk: Include clk.h in clk.c
clk: cdce925: Include clk.h
clk: moxart: Include clk.h
clk: si570: Include clk.h
clk: ingenic: Include clk.h
clk: pistachio: Include clk.h
clk: samsung: s5pv210-audss: Include clk.h
clk: ti: Switch clk-provider.h include to clk.h
clk: at91: Include clk.h and slab.h
clk: Remove clk.h from clk-provider.h

drivers/clk/at91/clk-slow.c | 2 ++
drivers/clk/bcm/clk-kona.c | 1 +
drivers/clk/clk-axi-clkgen.c | 1 -
drivers/clk/clk-cdce706.c | 1 +
drivers/clk/clk-cdce925.c | 1 +
drivers/clk/clk-clps711x.c | 1 -
drivers/clk/clk-efm32gg.c | 1 -
drivers/clk/clk-highbank.c | 1 +
drivers/clk/clk-moxart.c | 1 +
drivers/clk/clk-mux.c | 1 -
drivers/clk/clk-nomadik.c | 3 +--
drivers/clk/clk-palmas.c | 1 -
drivers/clk/clk-rk808.c | 1 -
drivers/clk/clk-si5351.c | 2 +-
drivers/clk/clk-si570.c | 1 +
drivers/clk/clk-twl6040.c | 1 -
drivers/clk/clk-u300.c | 2 +-
drivers/clk/clk-wm831x.c | 1 -
drivers/clk/clk.c | 1 +
drivers/clk/hisilicon/clk-hi3620.c | 2 --
drivers/clk/hisilicon/clk-hip04.c | 2 --
drivers/clk/hisilicon/clk.c | 3 +--
drivers/clk/hisilicon/clkgate-separated.c | 2 --
drivers/clk/ingenic/cgu.c | 1 +
drivers/clk/keystone/gate.c | 1 -
drivers/clk/keystone/pll.c | 1 -
drivers/clk/mediatek/clk-gate.h | 3 ++-
drivers/clk/mediatek/clk-mt8135.c | 1 +
drivers/clk/mediatek/clk-mt8173.c | 1 +
drivers/clk/mediatek/clk-mtk.h | 3 ++-
drivers/clk/meson/clk-cpu.c | 1 +
drivers/clk/meson/clkc.c | 1 -
drivers/clk/mmp/clk-apbc.c | 1 -
drivers/clk/mmp/clk-apmu.c | 1 -
drivers/clk/mmp/clk.c | 3 +--
drivers/clk/mvebu/clk-cpu.c | 3 ++-
drivers/clk/mvebu/common.c | 2 +-
drivers/clk/mxs/clk-div.c | 1 -
drivers/clk/mxs/clk-frac.c | 1 -
drivers/clk/mxs/clk-imx23.c | 3 +--
drivers/clk/mxs/clk-imx28.c | 2 +-
drivers/clk/mxs/clk-pll.c | 1 -
drivers/clk/mxs/clk-ref.c | 1 -
drivers/clk/mxs/clk.h | 3 ++-
drivers/clk/nxp/clk-lpc18xx-cgu.c | 1 -
drivers/clk/pistachio/clk.c | 1 +
drivers/clk/qcom/mmcc-msm8960.c | 1 +
drivers/clk/rockchip/clk-cpu.c | 1 +
drivers/clk/rockchip/clk-mmc-phase.c | 1 +
drivers/clk/rockchip/clk-pll.c | 1 -
drivers/clk/rockchip/clk-rk3188.c | 1 +
drivers/clk/rockchip/clk.h | 4 ++--
drivers/clk/samsung/clk-cpu.c | 3 +++
drivers/clk/samsung/clk-exynos-audss.c | 3 ++-
drivers/clk/samsung/clk-exynos-clkout.c | 2 +-
drivers/clk/samsung/clk-exynos3250.c | 2 --
drivers/clk/samsung/clk-exynos4.c | 2 +-
drivers/clk/samsung/clk-exynos4415.c | 2 --
drivers/clk/samsung/clk-exynos5250.c | 2 --
drivers/clk/samsung/clk-exynos5260.c | 2 --
drivers/clk/samsung/clk-exynos5410.c | 2 --
drivers/clk/samsung/clk-exynos5420.c | 3 +--
drivers/clk/samsung/clk-exynos5433.c | 2 --
drivers/clk/samsung/clk-exynos5440.c | 2 --
drivers/clk/samsung/clk-exynos7.c | 2 --
drivers/clk/samsung/clk-pll.c | 2 ++
drivers/clk/samsung/clk-s3c2410.c | 2 --
drivers/clk/samsung/clk-s3c2412.c | 2 --
drivers/clk/samsung/clk-s3c2443.c | 2 --
drivers/clk/samsung/clk-s3c64xx.c | 2 --
drivers/clk/samsung/clk-s5pv210-audss.c | 2 +-
drivers/clk/samsung/clk-s5pv210.c | 2 --
drivers/clk/samsung/clk.c | 4 ++++
drivers/clk/samsung/clk.h | 3 ++-
drivers/clk/sirf/clk-atlas6.c | 1 -
drivers/clk/sirf/clk-common.c | 2 ++
drivers/clk/sirf/clk-prima2.c | 1 -
drivers/clk/socfpga/clk-gate-a10.c | 1 +
drivers/clk/socfpga/clk-gate.c | 3 +--
drivers/clk/socfpga/clk-periph-a10.c | 1 +
drivers/clk/socfpga/clk-periph.c | 3 +--
drivers/clk/socfpga/clk-pll-a10.c | 1 +
drivers/clk/socfpga/clk-pll.c | 3 +--
drivers/clk/socfpga/clk.h | 1 -
drivers/clk/spear/spear1310_clock.c | 1 -
drivers/clk/spear/spear1340_clock.c | 1 -
drivers/clk/spear/spear3xx_clock.c | 1 -
drivers/clk/spear/spear6xx_clock.c | 1 -
drivers/clk/st/clk-flexgen.c | 1 +
drivers/clk/st/clkgen-fsyn.c | 1 +
drivers/clk/st/clkgen-mux.c | 1 +
drivers/clk/st/clkgen-pll.c | 1 +
drivers/clk/sunxi/clk-mod0.c | 3 ++-
drivers/clk/sunxi/clk-sun8i-mbus.c | 2 +-
drivers/clk/sunxi/clk-sun9i-core.c | 2 +-
drivers/clk/sunxi/clk-sun9i-mmc.c | 3 ++-
drivers/clk/sunxi/clk-sunxi.c | 2 ++
drivers/clk/sunxi/clk-usb.c | 3 ++-
drivers/clk/tegra/clk-divider.c | 1 -
drivers/clk/tegra/clk-periph-gate.c | 1 -
drivers/clk/tegra/clk-periph.c | 1 -
drivers/clk/tegra/clk-pll-out.c | 1 -
drivers/clk/tegra/clk-pll.c | 2 +-
drivers/clk/tegra/clk-super.c | 1 -
drivers/clk/tegra/clk-tegra-audio.c | 1 -
drivers/clk/tegra/clk-tegra-fixed.c | 1 -
drivers/clk/tegra/clk-tegra-periph.c | 1 -
drivers/clk/tegra/clk-tegra-pmc.c | 1 -
drivers/clk/tegra/clk-tegra-super-gen4.c | 1 -
drivers/clk/tegra/clk-tegra114.c | 2 --
drivers/clk/tegra/clk-tegra124.c | 1 -
drivers/clk/tegra/clk-tegra20.c | 1 -
drivers/clk/tegra/clk-tegra30.c | 1 -
drivers/clk/tegra/clk.c | 1 +
drivers/clk/ti/apll.c | 1 +
drivers/clk/ti/clk-2xxx.c | 2 +-
drivers/clk/ti/clk-33xx.c | 1 +
drivers/clk/ti/clk-3xxx-legacy.c | 1 +
drivers/clk/ti/clk-3xxx.c | 1 +
drivers/clk/ti/clk-43xx.c | 1 +
drivers/clk/ti/clk-dra7-atl.c | 1 +
drivers/clk/ti/clk.c | 1 +
drivers/clk/ti/clockdomain.c | 1 +
drivers/clk/ti/dpll.c | 1 +
drivers/clk/ti/fapll.c | 1 +
drivers/clk/ux500/abx500-clk.c | 1 -
drivers/clk/ux500/clk.h | 3 ++-
drivers/clk/ux500/u8500_clk.c | 1 -
drivers/clk/ux500/u8500_of_clk.c | 2 --
drivers/clk/ux500/u8540_clk.c | 1 -
drivers/clk/ux500/u9540_clk.c | 2 --
drivers/clk/versatile/clk-icst.c | 5 +++--
drivers/clk/versatile/clk-impd1.c | 1 -
drivers/clk/versatile/clk-realview.c | 1 -
drivers/clk/versatile/clk-sp810.c | 3 ++-
drivers/clk/versatile/clk-versatile.c | 2 --
drivers/clk/zynq/clkc.c | 1 +
include/linux/clk-provider.h | 2 +-
include/linux/clk/tegra.h | 3 ++-
139 files changed, 99 insertions(+), 128 deletions(-)

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 3/5] x86/vm86: Move fields from kernel_vm86_struct (no replies)

$
0
0
Move the non-regs fields to the off-stack data.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/include/asm/vm86.h | 17 ++++++++--------
arch/x86/kernel/vm86_32.c | 48 ++++++++++++++++++++++-----------------------
2 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/arch/x86/include/asm/vm86.h b/arch/x86/include/asm/vm86.h
index 88f14e3..bc28a40 100644
--- a/arch/x86/include/asm/vm86.h
+++ b/arch/x86/include/asm/vm86.h
@@ -38,13 +38,7 @@ struct kernel_vm86_struct {
* Therefore, pt_regs in fact points to a complete 'kernel_vm86_struct'
* in kernelspace, hence we need not reget the data from userspace.
*/
-#define VM86_TSS_ESP0 flags
- unsigned long flags;
- unsigned long screen_bitmap;
- unsigned long cpu_type;
- struct revectored_struct int_revectored;
- struct revectored_struct int21_revectored;
- struct vm86plus_info_struct vm86plus;
+#define VM86_TSS_ESP0 regs32
struct pt_regs *regs32; /* here we save the pointer to the old regs */
/*
* The below is not part of the structure, but the stack layout continues
@@ -60,12 +54,19 @@ struct kernel_vm86_struct {

struct kernel_vm86_info {
struct vm86_struct __user *vm86_info;
- unsigned long screen_bitmap;
unsigned long v86flags;
unsigned long v86mask;
unsigned long saved_sp0;
unsigned int saved_fs;
unsigned int saved_gs;
+
+ /* Must match vm86plus_struct after regs */
+ unsigned long flags;
+ unsigned long screen_bitmap;
+ unsigned long cpu_type;
+ struct revectored_struct int_revectored;
+ struct revectored_struct int21_revectored;
+ struct vm86plus_info_struct vm86plus;
};

#ifdef CONFIG_VM86
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index 8b29c9b..f174602 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -68,7 +68,6 @@


#define KVM86 ((struct kernel_vm86_struct *)regs)
-#define VMPI KVM86->vm86plus


/*
@@ -111,18 +110,16 @@ static int copy_vm86_regs_to_user(struct vm86_regs __user *user,

/* convert vm86_regs to kernel_vm86_regs */
static int copy_vm86_regs_from_user(struct kernel_vm86_regs *regs,
- const struct vm86_regs __user *user,
- unsigned extra)
+ const struct vm86_regs __user *user)
{
int ret = 0;

/* copy ax-fs inclusive */
ret += copy_from_user(regs, user, offsetof(struct kernel_vm86_regs, pt.orig_ax));
- /* copy orig_ax-__gsh+extra */
+ /* copy orig_ax-__gsh */
ret += copy_from_user(&regs->pt.orig_ax, &user->orig_eax,
sizeof(struct kernel_vm86_regs) -
- offsetof(struct kernel_vm86_regs, pt.orig_ax) +
- extra);
+ offsetof(struct kernel_vm86_regs, pt.orig_ax));
return ret;
}

@@ -261,18 +258,20 @@ static long do_sys_vm86(struct vm86plus_struct __user *v86, bool plus,
}
if (vm86->saved_sp0)
return -EPERM;
+ if (copy_vm86_regs_from_user(&info->regs, &v86->regs))
+ return -EFAULT;
if (plus) {
- if (copy_vm86_regs_from_user(&info->regs, &v86->regs,
- offsetof(struct kernel_vm86_struct, regs32) -
- sizeof(info->regs)))
+ if (copy_from_user(&vm86->flags, &v86->flags,
+ sizeof(struct vm86plus_struct) -
+ offsetof(struct vm86plus_struct, flags)))
return -EFAULT;
- info->vm86plus.is_vm86pus = 1;
+ vm86->vm86plus.is_vm86pus = 1;
} else {
- if (copy_vm86_regs_from_user(&info->regs, &v86->regs,
- offsetof(struct kernel_vm86_struct, vm86plus) -
- sizeof(info->regs)))
+ if (copy_from_user(&vm86->flags, &v86->flags,
+ sizeof(struct vm86_struct) -
+ offsetof(struct vm86_struct, flags)))
return -EFAULT;
- memset(&info->vm86plus, 0, sizeof(struct vm86plus_info_struct));
+ memset(&vm86->vm86plus, 0, sizeof(struct vm86plus_info_struct));
}
info->regs32 = current_pt_regs();
vm86->vm86_info = (struct vm86_struct __user *) v86;
@@ -297,7 +296,7 @@ static long do_sys_vm86(struct vm86plus_struct __user *v86, bool plus,
info->regs.pt.flags |= info->regs32->flags & ~SAFE_MASK;
info->regs.pt.flags |= X86_VM_MASK;

- switch (info->cpu_type) {
+ switch (vm86->cpu_type) {
case CPU_286:
vm86->v86mask = 0;
break;
@@ -327,8 +326,7 @@ static long do_sys_vm86(struct vm86plus_struct __user *v86, bool plus,
load_sp0(tss, &tsk->thread);
put_cpu();

- vm86->screen_bitmap = info->screen_bitmap;
- if (info->flags & VM86_SCREEN_BITMAP)
+ if (vm86->flags & VM86_SCREEN_BITMAP)
mark_screen_rdonly(tsk->mm);

/*call __audit_syscall_exit since we do not exit via the normal paths */
@@ -520,12 +518,13 @@ static void do_int(struct kernel_vm86_regs *regs, int i,
{
unsigned long __user *intr_ptr;
unsigned long segoffs;
+ struct kernel_vm86_info *vm86 = current->thread.vm86;

if (regs->pt.cs == BIOSSEG)
goto cannot_handle;
- if (is_revectored(i, &KVM86->int_revectored))
+ if (is_revectored(i, &vm86->int_revectored))
goto cannot_handle;
- if (i == 0x21 && is_revectored(AH(regs), &KVM86->int21_revectored))
+ if (i == 0x21 && is_revectored(AH(regs), &vm86->int21_revectored))
goto cannot_handle;
intr_ptr = (unsigned long __user *) (i << 2);
if (get_user(segoffs, intr_ptr))
@@ -549,7 +548,7 @@ cannot_handle:

int handle_vm86_trap(struct kernel_vm86_regs *regs, long error_code, int trapno)
{
- if (VMPI.is_vm86pus) {
+ if (current->thread.vm86->vm86plus.is_vm86pus) {
if ((trapno == 3) || (trapno == 1)) {
KVM86->regs32->ax = VM86_TRAP + (trapno << 8);
/* setting this flag forces the code in entry_32.S to
@@ -576,12 +575,13 @@ void handle_vm86_fault(struct kernel_vm86_regs *regs, long error_code)
unsigned char __user *ssp;
unsigned short ip, sp, orig_flags;
int data32, pref_done;
+ struct vm86plus_info_struct *vmpi = &current->thread.vm86->vm86plus;

#define CHECK_IF_IN_TRAP \
- if (VMPI.vm86dbg_active && VMPI.vm86dbg_TFpendig) \
+ if (vmpi->vm86dbg_active && vmpi->vm86dbg_TFpendig) \
newflags |= X86_EFLAGS_TF
#define VM86_FAULT_RETURN do { \
- if (VMPI.force_return_for_pic && (VEFLAGS & (X86_EFLAGS_IF | X86_EFLAGS_VIF))) \
+ if (vmpi->force_return_for_pic && (VEFLAGS & (X86_EFLAGS_IF | X86_EFLAGS_VIF))) \
return_to_32bit(regs, VM86_PICRETURN); \
if (orig_flags & X86_EFLAGS_TF) \
handle_vm86_trap(regs, 0, 1); \
@@ -651,8 +651,8 @@ void handle_vm86_fault(struct kernel_vm86_regs *regs, long error_code)
case 0xcd: {
int intno = popb(csp, ip, simulate_sigsegv);
IP(regs) = ip;
- if (VMPI.vm86dbg_active) {
- if ((1 << (intno & 7)) & VMPI.vm86dbg_intxxtab[intno >> 3])
+ if (vmpi->vm86dbg_active) {
+ if ((1 << (intno & 7)) & vmpi->vm86dbg_intxxtab[intno >> 3])
return_to_32bit(regs, VM86_INTx + (intno << 8));
}
do_int(regs, intno, ssp, sp);
--
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 0/5] x86/vm86: First round of vm86 cleanups (4 replies)

$
0
0
The goal of this set of patches is to change vm86 support to return to
userspace with the normal exit paths instead of leaving data on the kernel
stack and jumping directly into the exit asm routines. This fixes issues
like ptrace and syscall auditing not working with vm86, and makes possible
cleanups in the syscall exit work code.

arch/x86/entry/entry_32.S | 24 +---
arch/x86/include/asm/processor.h | 11 +-
arch/x86/include/asm/thread_info.h | 11 +-
arch/x86/include/asm/vm86.h | 36 ++---
arch/x86/kernel/process.c | 7 +
arch/x86/kernel/signal.c | 3 +
arch/x86/kernel/vm86_32.c | 265 ++++++++++++++++---------------------
arch/x86/mm/fault.c | 4 +-
8 files changed, 152 insertions(+), 209 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH] [media] rc/keymaps: Add helper macro for rc_map_list boilerplate (no replies)

$
0
0
For simple modules that contain a single rc_map_list without any
additional setup code then ends up being a block of duplicated
boilerplate. This patch adds a new macro, module_rc_map_list(),
which replaces the module_init()/module_exit() registrations with
template functions.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
---
include/media/rc-map.h | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 27763d5..07e765d 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -96,6 +96,16 @@ struct rc_map_list {
struct rc_map map;
};

+/**
+ * module_rc_map_list() - Helper macro for registering a RC drivers
+ * @__rc_map_list: rc_map_list struct
+ * Helper macro for RC drivers which do not do anything special in module
+ * init/exit. This eliminates a lot of boilerplate. Each module may only
+ * use this macro once, and calling it replaces module_init() and module_exit()
+ */
+#define module_rc_map_list(__rc_map_list) \
+ module_driver(__rc_map_list, rc_map_register, rc_map_unregister)
+
/* Routines from rc-map.c */

int rc_map_register(struct rc_map_list *map);
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 2/2] drivers: video: fbdev: vga: fixed coding style (no replies)

$
0
0
Fixed most of the coding style issues suggested by checkpatch.pl
tool. Mainly converted spaces to tabs. Left remaining errors and
warnings up to decision of the developers.

Signed-off-by: Cristian Ardelean <cristian97.ardelean@gmail.com>
---
drivers/video/fbdev/vga16fb.c | 386 ++++++++++++++++++++---------------------
1 file changed, 193 insertions(+), 193 deletions(-)

diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
index 283d335..2c035a7 100644
--- a/drivers/video/fbdev/vga16fb.c
+++ b/drivers/video/fbdev/vga16fb.c
@@ -1,13 +1,13 @@
/*
* linux/drivers/video/vga16.c -- VGA 16-color framebuffer driver
- *
+ *
* Copyright 1999 Ben Pfaff <pfaffben@debian.org> and Petr Vandrovec <VANDROVE@vc.cvut.cz>
* Based on VGA info at http://www.goodnet.com/~tinara/FreeVGA/home.htm
* Based on VESA framebuffer (c) 1998 Gerd Knorr <kraxel@goldbach.in-berlin.de>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
- * archive for more details.
+ * archive for more details.
*/

#include <linux/module.h>
@@ -41,7 +41,7 @@

struct vga16fb_par {
/* structure holding original VGA register settings when the
- screen is blanked */
+ screen is blanked */
struct {
unsigned char SeqCtrlIndex; /* Sequencer Index reg. */
unsigned char CrtCtrlIndex; /* CRT-Contr. Index reg. */
@@ -70,7 +70,7 @@ static struct fb_var_screeninfo vga16fb_defined = {
.yres = 480,
.xres_virtual = 640,
.yres_virtual = 480,
- .bits_per_pixel = 4,
+ .bits_per_pixel = 4,
.activate = FB_ACTIVATE_TEST,
.height = -1,
.width = -1,
@@ -120,7 +120,7 @@ static inline void rmw(volatile char __iomem *p)
static inline int setmode(int mode)
{
int oldmode;
-
+
oldmode = vga_io_rgfx(VGA_GFX_MODE);
vga_io_w(VGA_GFX_D, mode);
return oldmode;
@@ -139,19 +139,19 @@ static inline void setmask(int mask)
vga_io_w(VGA_GFX_D, mask);
}

-/* Set the Data Rotate Register and return its old value.
+/* Set the Data Rotate Register and return its old value.
Bits 0-2 are rotate count, bits 3-4 are logical operation
(0=NOP, 1=AND, 2=OR, 3=XOR). */
static inline int setop(int op)
{
int oldop;
-
+
oldop = vga_io_rgfx(VGA_GFX_DATA_ROTATE);
vga_io_w(VGA_GFX_D, op);
return oldop;
}

-/* Set the Enable Set/Reset Register and return its old value.
+/* Set the Enable Set/Reset Register and return its old value.
The code here always uses value 0xf for this register. */
static inline int setsr(int sr)
{
@@ -184,7 +184,7 @@ static inline void setindex(int index)
vga_io_w(VGA_GFX_I, index);
}

-static void vga16fb_pan_var(struct fb_info *info,
+static void vga16fb_pan_var(struct fb_info *info,
struct fb_var_screeninfo *var)
{
struct vga16fb_par *par = info->par;
@@ -194,7 +194,7 @@ static void vga16fb_pan_var(struct fb_info *info,
if (info->var.bits_per_pixel == 8) {
pos = (info->var.xres_virtual * var->yoffset + xoffset) >> 2;
} else if (par->mode & MODE_TEXT) {
- int fh = 16; // FIXME !!! font height. Fugde for now.
+ int fh = 16; /* FIXME !!! font height. Fugde for now. */
pos = (info->var.xres_virtual * (var->yoffset / fh) + xoffset) >> 3;
} else {
if (info->var.nonstd)
@@ -262,12 +262,14 @@ static void vga16fb_clock_chip(struct vga16fb_par *par,
pixclock = (pixclock * mul) / div;
best = vgaclocks;
err = pixclock - best->pixclock;
- if (err < 0) err = -err;
+ if (err < 0)
+ err = -err;
for (ptr = vgaclocks + 1; ptr->pixclock; ptr++) {
int tmp;

tmp = pixclock - ptr->pixclock;
- if (tmp < 0) tmp = -tmp;
+ if (tmp < 0)
+ tmp = -tmp;
if (tmp < err) {
err = tmp;
best = ptr;
@@ -275,9 +277,9 @@ static void vga16fb_clock_chip(struct vga16fb_par *par,
}
par->misc |= best->misc;
par->clkdiv = best->seq_clock_mode;
- pixclock = (best->pixclock * div) / mul;
+ pixclock = (best->pixclock * div) / mul;
}
-
+
#define FAIL(X) return -EINVAL

static int vga16fb_open(struct fb_info *info, int user)
@@ -439,8 +441,10 @@ static int vga16fb_check_var(struct fb_var_screeninfo *var,
FAIL("vslen too big");
par->crtc[VGA_CRTC_V_TOTAL] = ytotal - 2;
r7 = 0x10; /* disable linecompare */
- if (ytotal & 0x100) r7 |= 0x01;
- if (ytotal & 0x200) r7 |= 0x20;
+ if (ytotal & 0x100)
+ r7 |= 0x01;
+ if (ytotal & 0x200)
+ r7 |= 0x20;
par->crtc[VGA_CRTC_PRESET_ROW] = 0;
par->crtc[VGA_CRTC_MAX_SCAN] = 0x40; /* 1 scanline, no linecmp */
if (var->vmode & FB_VMODE_DOUBLE)
@@ -473,7 +477,7 @@ static int vga16fb_check_var(struct fb_var_screeninfo *var,
par->crtc[VGA_CRTC_V_SYNC_END] = (pos & 0x0F) & ~0x10; /* disabled IRQ */
pos += upper - 1; /* blank_end + 1 <= ytotal + 2 */
par->crtc[VGA_CRTC_V_BLANK_END] = pos & 0xFF; /* 0x7F for original VGA,
- but some SVGA chips requires all 8 bits to set */
+ but some SVGA chips requires all 8 bits to set */
if (vxres >= 512)
FAIL("vxres too long");
par->crtc[VGA_CRTC_OFFSET] = vxres >> 1;
@@ -492,7 +496,7 @@ static int vga16fb_check_var(struct fb_var_screeninfo *var,
par->misc &= ~0x40;
if (var->sync & FB_SYNC_VERT_HIGH_ACT)
par->misc &= ~0x80;
-
+
par->mode = mode;

if (mode & MODE_8BPP)
@@ -501,8 +505,8 @@ static int vga16fb_check_var(struct fb_var_screeninfo *var,
else
/* pixel clock == vga clock */
vga16fb_clock_chip(par, var->pixclock, info, 1, 1);
-
- var->red.offset = var->green.offset = var->blue.offset =
+
+ var->red.offset = var->green.offset = var->blue.offset =
var->transp.offset = 0;
var->red.length = var->green.length = var->blue.length =
(par->isVGA) ? 6 : 2;
@@ -569,10 +573,10 @@ static int vga16fb_set_par(struct fb_info *info)
else
atc[VGA_ATC_PEL] = info->var.xoffset & 7;
atc[VGA_ATC_COLOR_PAGE] = 0x00;
-
+
if (par->mode & MODE_TEXT) {
- fh = 16; // FIXME !!! Fudge font height.
- par->crtc[VGA_CRTC_MAX_SCAN] = (par->crtc[VGA_CRTC_MAX_SCAN]
+ fh = 16; /* FIXME !!! Fudge font height. */
+ par->crtc[VGA_CRTC_MAX_SCAN] = (par->crtc[VGA_CRTC_MAX_SCAN]
& ~0x1F) | (fh - 1);
}

@@ -583,10 +587,10 @@ static int vga16fb_set_par(struct fb_info *info)
vga_io_w(EGA_GFX_E0, 0x00);
vga_io_w(EGA_GFX_E1, 0x01);
}
-
+
/* update misc output register */
vga_io_w(VGA_MIS_W, par->misc);
-
+
/* synchronous reset on */
vga_io_wseq(0x00, 0x01);

@@ -595,10 +599,9 @@ static int vga16fb_set_par(struct fb_info *info)

/* write sequencer registers */
vga_io_wseq(VGA_SEQ_CLOCK_MODE, seq[VGA_SEQ_CLOCK_MODE] | 0x20);
- for (i = 2; i < VGA_SEQ_C; i++) {
+ for (i = 2; i < VGA_SEQ_C; i++)
vga_io_wseq(i, seq);
- }
-
+
/* synchronous reset off */
vga_io_wseq(0x00, 0x03);

@@ -606,15 +609,13 @@ static int vga16fb_set_par(struct fb_info *info)
vga_io_wcrt(VGA_CRTC_V_SYNC_END, par->crtc[VGA_CRTC_V_SYNC_END]);

/* write CRT registers */
- for (i = 0; i < VGA_CRTC_REGS; i++) {
+ for (i = 0; i < VGA_CRTC_REGS; i++)
vga_io_wcrt(i, par->crtc);
- }
-
+
/* write graphics controller registers */
- for (i = 0; i < VGA_GFX_C; i++) {
+ for (i = 0; i < VGA_GFX_C; i++)
vga_io_wgfx(i, gdc);
- }
-
+
/* write attribute controller registers */
for (i = 0; i < VGA_ATT_C; i++) {
vga_io_r(VGA_IS1_RC); /* reset flip-flop */
@@ -637,7 +638,7 @@ static void ega16_setpalette(int regno, unsigned red, unsigned green, unsigned b
{
static const unsigned char map[] = { 000, 001, 010, 011 };
int val;
-
+
if (regno >= 16)
return;
val = map[red>>14] | ((map[green>>14]) << 1) | ((map[blue>>14]) << 2);
@@ -668,25 +669,25 @@ static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green,
* (according to the entries in the `var' structure). Return
* != 0 for invalid regno.
*/
-
+
if (regno >= 256)
return 1;

gray = info->var.grayscale;
-
+
if (gray) {
/* gray = 0.30*R + 0.59*G + 0.11*B */
red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
}
- if (par->isVGA)
- vga16_setpalette(regno,red,green,blue);
+ if (par->isVGA)
+ vga16_setpalette(regno, red, green, blue);
else
- ega16_setpalette(regno,red,green,blue);
+ ega16_setpalette(regno, red, green, blue);
return 0;
}

static int vga16fb_pan_display(struct fb_var_screeninfo *var,
- struct fb_info *info)
+ struct fb_info *info)
{
vga16fb_pan_var(info, var);
return 0;
@@ -701,11 +702,11 @@ static void vga_vesa_blank(struct vga16fb_par *par, int mode)
{
unsigned char SeqCtrlIndex = vga_io_r(VGA_SEQ_I);
unsigned char CrtCtrlIndex = vga_io_r(VGA_CRT_IC);
-
+
/* save original values of VGA controller registers */
- if(!par->vesa_blanked) {
+ if (!par->vesa_blanked) {
par->vga_state.CrtMiscIO = vga_io_r(VGA_MIS_R);
- //sti();
+ /* sti(); */

par->vga_state.HorizontalTotal = vga_io_rcrt(0x00); /* HorizontalTotal */
par->vga_state.HorizDisplayEnd = vga_io_rcrt(0x01); /* HorizDisplayEnd */
@@ -757,7 +758,7 @@ static void vga_vesa_unblank(struct vga16fb_par *par)
{
unsigned char SeqCtrlIndex = vga_io_r(VGA_SEQ_I);
unsigned char CrtCtrlIndex = vga_io_r(VGA_CRT_IC);
-
+
/* restore original values of VGA controller registers */
vga_io_w(VGA_MIS_W, par->vga_state.CrtMiscIO);

@@ -789,7 +790,7 @@ static void vga_pal_blank(void)
{
int i;

- for (i=0; i<16; i++) {
+ for (i = 0; i < 16; i++) {
outb_p(i, VGA_PEL_IW);
outb_p(0, VGA_PEL_D);
outb_p(0, VGA_PEL_D);
@@ -808,9 +809,8 @@ static int vga16fb_blank(int blank, struct fb_info *info)
vga_vesa_unblank(par);
par->vesa_blanked = 0;
}
- if (par->palette_blanked) {
+ if (par->palette_blanked)
par->palette_blanked = 0;
- }
break;
case FB_BLANK_NORMAL: /* blank */
vga_pal_blank();
@@ -827,55 +827,55 @@ static int vga16fb_blank(int blank, struct fb_info *info)
static void vga_8planes_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{
u32 dx = rect->dx, width = rect->width;
- char oldindex = getindex();
- char oldmode = setmode(0x40);
- char oldmask = selectmask();
- int line_ofs, height;
- char oldop, oldsr;
- char __iomem *where;
-
- dx /= 4;
- where = info->screen_base + dx + rect->dy * info->fix.line_length;
-
- if (rect->rop == ROP_COPY) {
- oldop = setop(0);
- oldsr = setsr(0);
-
- width /= 4;
- line_ofs = info->fix.line_length - width;
- setmask(0xff);
-
- height = rect->height;
-
- while (height--) {
- int x;
-
- /* we can do memset... */
- for (x = width; x > 0; --x) {
- writeb(rect->color, where);
- where++;
- }
- where += line_ofs;
- }
- } else {
- char oldcolor = setcolor(0xf);
- int y;
-
- oldop = setop(0x18);
- oldsr = setsr(0xf);
- setmask(0x0F);
- for (y = 0; y < rect->height; y++) {
- rmw(where);
- rmw(where+1);
- where += info->fix.line_length;
- }
- setcolor(oldcolor);
- }
- setmask(oldmask);
- setsr(oldsr);
- setop(oldop);
- setmode(oldmode);
- setindex(oldindex);
+ char oldindex = getindex();
+ char oldmode = setmode(0x40);
+ char oldmask = selectmask();
+ int line_ofs, height;
+ char oldop, oldsr;
+ char __iomem *where;
+
+ dx /= 4;
+ where = info->screen_base + dx + rect->dy * info->fix.line_length;
+
+ if (rect->rop == ROP_COPY) {
+ oldop = setop(0);
+ oldsr = setsr(0);
+
+ width /= 4;
+ line_ofs = info->fix.line_length - width;
+ setmask(0xff);
+
+ height = rect->height;
+
+ while (height--) {
+ int x;
+
+ /* we can do memset... */
+ for (x = width; x > 0; --x) {
+ writeb(rect->color, where);
+ where++;
+ }
+ where += line_ofs;
+ }
+ } else {
+ char oldcolor = setcolor(0xf);
+ int y;
+
+ oldop = setop(0x18);
+ oldsr = setsr(0xf);
+ setmask(0x0F);
+ for (y = 0; y < rect->height; y++) {
+ rmw(where);
+ rmw(where+1);
+ where += info->fix.line_length;
+ }
+ setcolor(oldcolor);
+ }
+ setmask(oldmask);
+ setsr(oldsr);
+ setop(oldop);
+ setmode(oldmode);
+ setindex(oldindex);
}

static void vga16fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
@@ -943,7 +943,7 @@ static void vga16fb_fillrect(struct fb_info *info, const struct fb_fillrect *rec
}
break;
}
- } else
+ } else
vga_8planes_fillrect(info, rect);
break;
case FB_TYPE_PACKED_PIXELS:
@@ -955,62 +955,62 @@ static void vga16fb_fillrect(struct fb_info *info, const struct fb_fillrect *rec

static void vga_8planes_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
- char oldindex = getindex();
- char oldmode = setmode(0x41);
- char oldop = setop(0);
- char oldsr = setsr(0xf);
- int height, line_ofs, x;
+ char oldindex = getindex();
+ char oldmode = setmode(0x41);
+ char oldop = setop(0);
+ char oldsr = setsr(0xf);
+ int height, line_ofs, x;
u32 sx, dx, width;
char __iomem *dest;
char __iomem *src;

- height = area->height;
-
- sx = area->sx / 4;
- dx = area->dx / 4;
- width = area->width / 4;
-
- if (area->dy < area->sy || (area->dy == area->sy && dx < sx)) {
- line_ofs = info->fix.line_length - width;
- dest = info->screen_base + dx + area->dy * info->fix.line_length;
- src = info->screen_base + sx + area->sy * info->fix.line_length;
- while (height--) {
- for (x = 0; x < width; x++) {
- readb(src);
- writeb(0, dest);
- src++;
- dest++;
- }
- src += line_ofs;
- dest += line_ofs;
- }
- } else {
- line_ofs = info->fix.line_length - width;
- dest = info->screen_base + dx + width +
+ height = area->height;
+
+ sx = area->sx / 4;
+ dx = area->dx / 4;
+ width = area->width / 4;
+
+ if (area->dy < area->sy || (area->dy == area->sy && dx < sx)) {
+ line_ofs = info->fix.line_length - width;
+ dest = info->screen_base + dx + area->dy * info->fix.line_length;
+ src = info->screen_base + sx + area->sy * info->fix.line_length;
+ while (height--) {
+ for (x = 0; x < width; x++) {
+ readb(src);
+ writeb(0, dest);
+ src++;
+ dest++;
+ }
+ src += line_ofs;
+ dest += line_ofs;
+ }
+ } else {
+ line_ofs = info->fix.line_length - width;
+ dest = info->screen_base + dx + width +
(area->dy + height - 1) * info->fix.line_length;
- src = info->screen_base + sx + width +
+ src = info->screen_base + sx + width +
(area->sy + height - 1) * info->fix.line_length;
- while (height--) {
- for (x = 0; x < width; x++) {
- --src;
- --dest;
- readb(src);
- writeb(0, dest);
- }
- src -= line_ofs;
- dest -= line_ofs;
- }
- }
-
- setsr(oldsr);
- setop(oldop);
- setmode(oldmode);
- setindex(oldindex);
+ while (height--) {
+ for (x = 0; x < width; x++) {
+ --src;
+ --dest;
+ readb(src);
+ writeb(0, dest);
+ }
+ src -= line_ofs;
+ dest -= line_ofs;
+ }
+ }
+
+ setsr(oldsr);
+ setop(oldop);
+ setmode(oldmode);
+ setindex(oldindex);
}

static void vga16fb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
- u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;
+ u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;
int x, x2, y2, old_dx, old_dy, vxres, vyres;
int height, width, line_ofs;
char __iomem *dst = NULL;
@@ -1076,9 +1076,9 @@ static void vga16fb_copyarea(struct fb_info *info, const struct fb_copyarea *are
dst += line_ofs;
}
} else {
- dst = info->screen_base + (dx/8) + width +
+ dst = info->screen_base + (dx/8) + width +
(dy + height - 1) * info->fix.line_length;
- src = info->screen_base + (sx/8) + width +
+ src = info->screen_base + (sx/8) + width +
(sy + height - 1) * info->fix.line_length;
while (height--) {
for (x = 0; x < width; x++) {
@@ -1091,7 +1091,7 @@ static void vga16fb_copyarea(struct fb_info *info, const struct fb_copyarea *are
dst -= line_ofs;
}
}
- } else
+ } else
vga_8planes_copyarea(info, area);
break;
case FB_TYPE_PACKED_PIXELS:
@@ -1101,7 +1101,8 @@ static void vga16fb_copyarea(struct fb_info *info, const struct fb_copyarea *are
}
}

-#define TRANS_MASK_LOW {0x0,0x8,0x4,0xC,0x2,0xA,0x6,0xE,0x1,0x9,0x5,0xD,0x3,0xB,0x7,0xF}
+#define TRANS_MASK_LOW {0x0, 0x8, 0x4, 0xC, 0x2, 0xA, 0x6, 0xE, \
+ 0x1, 0x9, 0x5, 0xD, 0x3, 0xB, 0x7, 0xF}
#define TRANS_MASK_HIGH {0x000, 0x800, 0x400, 0xC00, 0x200, 0xA00, 0x600, 0xE00, \
0x100, 0x900, 0x500, 0xD00, 0x300, 0xB00, 0x700, 0xF00}

@@ -1117,33 +1118,33 @@ static const u16 transl_h[] = TRANS_MASK_LOW;

static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *image)
{
- char oldindex = getindex();
- char oldmode = setmode(0x40);
- char oldop = setop(0);
- char oldsr = setsr(0);
- char oldmask = selectmask();
- const char *cdat = image->data;
+ char oldindex = getindex();
+ char oldmode = setmode(0x40);
+ char oldop = setop(0);
+ char oldsr = setsr(0);
+ char oldmask = selectmask();
+ const char *cdat = image->data;
u32 dx = image->dx;
- char __iomem *where;
- int y;
-
- dx /= 4;
- where = info->screen_base + dx + image->dy * info->fix.line_length;
-
- setmask(0xff);
- writeb(image->bg_color, where);
- readb(where);
- selectmask();
- setmask(image->fg_color ^ image->bg_color);
- setmode(0x42);
- setop(0x18);
- for (y = 0; y < image->height; y++, where += info->fix.line_length)
- writew(transl_h[cdat[y]&0xF] | transl_l[cdat[y] >> 4], where);
- setmask(oldmask);
- setsr(oldsr);
- setop(oldop);
- setmode(oldmode);
- setindex(oldindex);
+ char __iomem *where;
+ int y;
+
+ dx /= 4;
+ where = info->screen_base + dx + image->dy * info->fix.line_length;
+
+ setmask(0xff);
+ writeb(image->bg_color, where);
+ readb(where);
+ selectmask();
+ setmask(image->fg_color ^ image->bg_color);
+ setmode(0x42);
+ setop(0x18);
+ for (y = 0; y < image->height; y++, where += info->fix.line_length)
+ writew(transl_h[cdat[y]&0xF] | transl_l[cdat[y] >> 4], where);
+ setmask(oldmask);
+ setsr(oldsr);
+ setop(oldop);
+ setmode(oldmode);
+ setindex(oldindex);
}

static void vga_imageblit_expand(struct fb_info *info, const struct fb_image *image)
@@ -1164,7 +1165,6 @@ static void vga_imageblit_expand(struct fb_info *info, const struct fb_image *im
setsr(0xf);
setcolor(image->fg_color);
selectmask();
-
setmask(0xff);
writeb(image->bg_color, where);
rmb();
@@ -1173,7 +1173,7 @@ static void vga_imageblit_expand(struct fb_info *info, const struct fb_image *im
wmb();
for (y = 0; y < image->height; y++) {
dst = where;
- for (x = image->width/8; x--;)
+ for (x = image->width/8; x--;)
writeb(*cdat++, dst++);
where += info->fix.line_length;
}
@@ -1184,11 +1184,10 @@ static void vga_imageblit_expand(struct fb_info *info, const struct fb_image *im
setsr(0xf);
setcolor(image->bg_color);
selectmask();
-
setmask(0xff);
for (y = 0; y < image->height; y++) {
dst = where;
- for (x=image->width/8; x--;){
+ for (x = image->width/8; x--;) {
rmw(dst);
setcolor(image->fg_color);
selectmask();
@@ -1200,7 +1199,7 @@ static void vga_imageblit_expand(struct fb_info *info, const struct fb_image *im
where += info->fix.line_length;
}
}
- } else
+ } else
vga_8planes_imageblit(info, image);
break;
case FB_TYPE_PACKED_PIXELS:
@@ -1213,7 +1212,7 @@ static void vga_imageblit_expand(struct fb_info *info, const struct fb_image *im
static void vga_imageblit_color(struct fb_info *info, const struct fb_image *image)
{
/*
- * Draw logo
+ * Draw logo
*/
struct vga16fb_par *par = info->par;
char __iomem *where =
@@ -1230,7 +1229,7 @@ static void vga_imageblit_color(struct fb_info *info, const struct fb_image *ima
setsr(0xf);
setop(0);
setmode(0);
-
+
for (y = 0; y < image->height; y++) {
for (x = 0; x < image->width; x++) {
dst = where + x/8;
@@ -1254,7 +1253,7 @@ static void vga_imageblit_color(struct fb_info *info, const struct fb_image *ima
break;
}
}
-
+
static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image)
{
if (image->depth == 1)
@@ -1273,14 +1272,14 @@ static void vga16fb_destroy(struct fb_info *info)

static struct fb_ops vga16fb_ops = {
.owner = THIS_MODULE,
- .fb_open = vga16fb_open,
- .fb_release = vga16fb_release,
+ .fb_open = vga16fb_open,
+ .fb_release = vga16fb_release,
.fb_destroy = vga16fb_destroy,
.fb_check_var = vga16fb_check_var,
.fb_set_par = vga16fb_set_par,
- .fb_setcolreg = vga16fb_setcolreg,
- .fb_pan_display = vga16fb_pan_display,
- .fb_blank = vga16fb_blank,
+ .fb_setcolreg = vga16fb_setcolreg,
+ .fb_pan_display = vga16fb_pan_display,
+ .fb_blank = vga16fb_blank,
.fb_fillrect = vga16fb_fillrect,
.fb_copyarea = vga16fb_copyarea,
.fb_imageblit = vga16fb_imageblit,
@@ -1290,12 +1289,13 @@ static struct fb_ops vga16fb_ops = {
static int __init vga16fb_setup(char *options)
{
char *this_opt;
-
+
if (!options || !*options)
return 0;
-
+
while ((this_opt = strsep(&options, ",")) != NULL) {
- if (!*this_opt) continue;
+ if (!*this_opt)
+ continue;
}
return 0;
}
@@ -1337,11 +1337,11 @@ static int vga16fb_probe(struct platform_device *dev)
par->palette_blanked = 0;
par->vesa_blanked = 0;

- i = par->isVGA? 6 : 2;
-
+ i = par->isVGA ? 6 : 2;
+
vga16fb_defined.red.length = i;
vga16fb_defined.green.length = i;
- vga16fb_defined.blue.length = i;
+ vga16fb_defined.blue.length = i;

/* name should not depend on EGA/VGA */
info->fbops = &vga16fb_ops;
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 2/2] mm/shrinker: add init_shrinker() function (no replies)

$
0
0
All zeroes shrinker is now treated as 'initialized, but
not registered'. If, for some reason, you can't zero your
shrinker struct (or don't want to) then use init_shrinker()
function. Otherwise, in some cases, unregister_shrinker()
may Oops.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
include/linux/shrinker.h | 1 +
mm/vmscan.c | 12 ++++++++++++
2 files changed, 13 insertions(+)

diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
index 4fcacd9..bffb660 100644
--- a/include/linux/shrinker.h
+++ b/include/linux/shrinker.h
@@ -67,6 +67,7 @@ struct shrinker {
#define SHRINKER_NUMA_AWARE (1 << 0)
#define SHRINKER_MEMCG_AWARE (1 << 1)

+extern void init_shrinker(struct shrinker *);
extern int register_shrinker(struct shrinker *);
extern void unregister_shrinker(struct shrinker *);
#endif
diff --git a/mm/vmscan.c b/mm/vmscan.c
index cadc8a2..4bbcfcf 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -221,6 +221,18 @@ static unsigned long get_lru_size(struct lruvec *lruvec, enum lru_list lru)
}

/*
+ * All-zeroes shrinker considered to be initialized. Use this
+ * function if you can't (don't want to) zero out your shrinker
+ * structure.
+ */
+void init_shrinker(struct shrinker *shrinker)
+{
+ shrinker->nr_deferred = NULL;
+ INIT_LIST_HEAD(&shrinker->list);
+}
+EXPORT_SYMBOL(init_shrinker);
+
+/*
* Add a shrinker callback to be called from the vm.
*/
int register_shrinker(struct shrinker *shrinker)
--
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 1/2] mm/shrinker: do not NULL dereference uninitialized shrinker (no replies)

$
0
0
Consider 'all zeroes' shrinker as 'initialized, but not
registered', and, thus, don't unregister such a shrinker.
This helps to avoid accidental NULL pointer dereferences,
when a zeroed shrinker struct is getting passed to
unregister_shrinker() in error handing path, for example.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
mm/vmscan.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c8d8282..cadc8a2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -254,6 +254,12 @@ EXPORT_SYMBOL(register_shrinker);
*/
void unregister_shrinker(struct shrinker *shrinker)
{
+ /*
+ * All-zeroes is 'initialized, but not registered' shrinker.
+ */
+ if (unlikely(!shrinker->list.next))
+ return;
+
down_write(&shrinker_rwsem);
list_del(&shrinker->list);
up_write(&shrinker_rwsem);
--
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH] ASoC: sti-sas: fix platform_no_drv_owner.cocci warnings (no replies)

$
0
0
sound/soc/codecs/sti-sas.c:616:3-8: No need to set .owner here. The core will do it.

Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

CC: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

sti-sas.c | 1 -
1 file changed, 1 deletion(-)

--- a/sound/soc/codecs/sti-sas.c
+++ b/sound/soc/codecs/sti-sas.c
@@ -613,7 +613,6 @@ static int sti_sas_driver_remove(struct
static struct platform_driver sti_sas_platform_driver = {
.driver = {
.name = "sti-sas-codec",
- .owner = THIS_MODULE,
.of_match_table = sti_sas_dev_match,
},
.probe = sti_sas_driver_probe,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH 0/2] mm/shrinker: make unregister_shrinker() less fragile (1 reply)

$
0
0
Hello,

Shrinker API does not handle nicely unregister_shrinker() on a not-registered
->shrinker. Looking at shrinker users, they all have to
(a) carry on some sort of a flag to make sure that "unregister_shrinker()"
will not blow up later
(b) be fishy (potentially can Oops)
(c) access private members `struct shrinker' (e.g. `shrink.list.next')

Change unregister_shrinker() to consider all-zeroes shrinker as
'initialized, but not registered' shrinker, so we can avoid NULL
dereference when unregister_shrinker() accidentally receives such
a struct.

Introduce init_shrinker() function to init `critical' shrinkers members
when the entire shrinker cannot be, for some reason, zeroed out. This
also helps to avoid Oops in unregister_shrinker() in some cases (when
unregister_shrinker() receives not initialized and not registered shrinker).

Sergey Senozhatsky (2):
mm/shrinker: do not NULL dereference uninitialized shrinker
mm/shrinker: add init_shrinker() function

include/linux/shrinker.h | 1 +
mm/vmscan.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)

--
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH] net: switchdev: don't abort unsupported operations (1 reply)

$
0
0
There is no need to abort attribute setting or object addition, if the
prepare phase returned operation not supported.

Thus, abort these two transactions only if the error is not -EOPNOTSUPP.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
net/switchdev/switchdev.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 84f77a0..9f2add3 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -171,8 +171,10 @@ int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr)
* released.
*/

- attr->trans = SWITCHDEV_TRANS_ABORT;
- __switchdev_port_attr_set(dev, attr);
+ if (err != -EOPNOTSUPP) {
+ attr->trans = SWITCHDEV_TRANS_ABORT;
+ __switchdev_port_attr_set(dev, attr);
+ }

return err;
}
@@ -249,8 +251,10 @@ int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj)
* released.
*/

- obj->trans = SWITCHDEV_TRANS_ABORT;
- __switchdev_port_obj_add(dev, obj);
+ if (err != -EOPNOTSUPP) {
+ obj->trans = SWITCHDEV_TRANS_ABORT;
+ __switchdev_port_obj_add(dev, obj);
+ }

return err;
}
--
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH] ipc: convert invalid scenarios to use WARN_ON (no replies)

$
0
0
Considering Linus' past rants about the (ab)use of BUG in the kernel,
I took a look at how we deal with such calls in ipc. Given that any
errors or corruption in ipc code are most likely contained within
the set of processes participating in the broken mechanisms, there
aren't really many strong fatal system failure scenarios that would
require a BUG call. Also, if something is seriously wrong, ipc might
not be the place for such a BUG either.

1. For example, recently, a customer hit one of these BUG_ONs in shm
after failing shm_lock(). A busted ID imho does not merit a BUG_ON,
and WARN would have been better.

2. MSG_COPY functionality of posix msgrcv(2) for checkpoint/restore.
I don't see how we can hit this anyway -- at least it should be
IS_ERR. The 'copy' arg from do_msgrcv is always set by calling
prepare_copy() first and foremost. We could also probably drop
this check altogether. Either way, it does not merit a BUG_ON.

3. No ->fault() callback for the fs getting the corresponding page --
seems selfish to make the system unusable.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
ipc/msgutil.c | 2 +-
ipc/shm.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index 2b49159..71f448e 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -123,7 +123,7 @@ struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
size_t len = src->m_ts;
size_t alen;

- BUG_ON(dst == NULL);
+ WARN_ON(dst == NULL);
if (src->m_ts > dst->m_ts)
return ERR_PTR(-EINVAL);

diff --git a/ipc/shm.c b/ipc/shm.c
index 06e5cf2..bcb1bad 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -159,7 +159,7 @@ static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id)
* We raced in the idr lookup or with shm_destroy(). Either way, the
* ID is busted.
*/
- BUG_ON(IS_ERR(ipcp));
+ WARN_ON(IS_ERR(ipcp));

return container_of(ipcp, struct shmid_kernel, shm_perm);
}
@@ -393,7 +393,7 @@ static int shm_mmap(struct file *file, struct vm_area_struct *vma)
return ret;
sfd->vm_ops = vma->vm_ops;
#ifdef CONFIG_MMU
- BUG_ON(!sfd->vm_ops->fault);
+ WARN_ON(!sfd->vm_ops->fault);
#endif
vma->vm_ops = &shm_vm_ops;
shm_open(vma);
--
2.1.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[git pull] Input updates for 4.2-rc1 (no replies)

$
0
0
Hi Linus,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive updates for the input subsystem. You'll get a fix (revert)
for a recent regression in Synaptics driver and a fix for Elan i2c
touchpad driver.

Changelog:
---------

Dmitry Torokhov (1):
Revert "Input: synaptics - allocate 3 slots to keep stability in image sensors"

duson (1):
Input: elan_i2c - change the hover event from MT to ST


Diffstat:
--------

drivers/input/mouse/elan_i2c_core.c | 12 +++++-------
drivers/input/mouse/synaptics.c | 2 +-
2 files changed, 6 insertions(+), 8 deletions(-)

--
Dmitry

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

[PATCH] sysctl: Fix conversion of INT_MIN for LP64 systems (no replies)

$
0
0
On LP64 systems, reading a sysctl file containing an INT_MIN (-2147483648)
could incorrectly show -18446744071562067968 due to an incorrect conversion
in do_proc_dointvec_conv. This patch fixes the edge case by converting to
unsigned int first to avoid sign extending INT_MIN to unsigned long.

Test:

root:/proc/sys/kernel# echo -2147483648 0 0 0 > printk
root:/proc/sys/kernel# cat printk

Without patch, produces -18446744071562067968 0 0 0.
With patch, should produce -2147483648 0 0 0.

Signed-off-by: Robert Xiao <brx@cs.cmu.edu>
---
kernel/sysctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 19b62b5..464df36 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1995,10 +1995,10 @@ static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
int val = *valp;
if (val < 0) {
*negp = true;
- *lvalp = (unsigned long)-val;
+ *lvalp = (unsigned int)-val;
} else {
*negp = false;
- *lvalp = (unsigned long)val;
+ *lvalp = (unsigned int)val;
}
}
return 0;
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Viewing all 24115 articles
Browse latest View live