aboutsummaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* lib: Add support for LZ4-compressed kernelKyungsik Lee2014-08-011-0/+5
| | | | | | | | | | | | | | | | | | Date Tue, 26 Feb 2013 15:24:28 +0900 This patch adds support for extracting LZ4-compressed kernel images, as well as LZ4-compressed ramdisk images in the kernel boot process. This depends on the patch below decompressor: Add LZ4 decompressor module Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com> v2: - Clean up code - Use lz4_decompress() for LZ4-compressed kernel during boot-process Signed-off-by: Paul Reioux <reioux@gmail.com>
* Merge remote-tracking branch 'caf/kk_2.7_rb1.41' into cm-11.0dhacker292014-07-121-1/+11
|\ | | | | | | | | | | | | | | Conflicts: kernel/events/core.c net/ipv4/ping.c Change-Id: Ic359877769a851a4693579e5f0df7555fcfd1461
| * scripts/kallsyms: filter symbols not in kernel address spaceMing Lei2014-05-191-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses CONFIG_PAGE_OFFSET to filter symbols which are not in kernel address space because these symbols are generally for generating code purpose and can't be run at kernel mode, so we needn't keep them in /proc/kallsyms. For example, on ARM there are some symbols which may be linked in relocatable code section, then perf can't parse symbols any more from /proc/kallsyms, this patch fixes the problem (introduced b9b32bf70f2fb710b07c94e13afbc729afe221da) Change-Id: I3d6321b7d87727c7c2802b3924f2e89a28e4b9ca Cc: Russell King <linux@arm.linux.org.uk> Cc: linux-arm-kernel@lists.infradead.org Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: stable@vger.kernel.org Git-commit: f6537f2f0eba4eba3354e48dbe3047db6d8b6254 Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git [nleeder@codeaurora.org: move flag to Makefile because original file scripts/link-vmlinux.sh does not exist in 3.4] Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
* | ARM: convert build of appended dtb zImage to list of dtbsColin Cross2014-07-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES to specify a space separated list of dtbs to append to the zImage, and name the resulting file zImage-dtb Signed-off-by: Colin Cross <ccross@android.com> Conflicts: arch/arm/Kconfig arch/arm/Makefile Signed-off-by: Patrick Tjin <pattjin@google.com> Change-Id: Id812b45d449d8a3f391717a8cbe21feef211d2c7
* | Merge tag 'v3.4.97' into cm-11.0dhacker292014-07-081-2/+2
|\ \ | | | | | | | | | This is the 3.4.97 stable release
| * | recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modulesAlex Smith2014-07-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 91ad11d7cc6f4472ebf177a6252fbf0fd100d798 upstream. On MIPS calls to _mcount in modules generate 2 instructions to load the _mcount address (and therefore 2 relocations). The mcount_loc table should only reference the first of these, so the second is filtered out by checking the relocation offset and ignoring ones that immediately follow the previous one seen. However if a module has an _mcount call at offset 0, the second relocation would not be filtered out due to old_r_offset == 0 being taken to mean that the current relocation is the first one seen, and both would end up in the mcount_loc table. This results in ftrace_make_nop() patching both (adjacent) instructions to branches over the _mcount call sequence like so: 0xffffffffc08a8000: 04 00 00 10 b 0xffffffffc08a8014 0xffffffffc08a8004: 04 00 00 10 b 0xffffffffc08a8018 0xffffffffc08a8008: 2d 08 e0 03 move at,ra ... The second branch is in the delay slot of the first, which is defined to be unpredictable - on the platform on which this bug was encountered, it triggers a reserved instruction exception. Fix by initializing old_r_offset to ~0 and using that instead of 0 to determine whether the current relocation is the first seen. Signed-off-by: Alex Smith <alex.smith@imgtec.com> Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/7098/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | Merge tag 'v3.4.91' into cm-11.0dhacker292014-06-071-2/+6
|\| | | | | | | | | | | This is the 3.4.91 stable release
| * | powerpc: Add vr save/restore functionsAndreas Schwab2014-05-181-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 8fe9c93e7453e67b8bd09f263ec1bb0783c733fc upstream. GCC 4.8 now generates out-of-line vr save/restore functions when optimizing for size. They are needed for the raid6 altivec support. Signed-off-by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | Merge tag 'v3.4.87' into cm-11.0dhacker292014-04-191-5/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the 3.4.87 stable release Conflicts: arch/arm/boot/compressed/Makefile arch/arm/mm/proc-v7.S drivers/media/dvb/dvb-core/dmxdev.c drivers/usb/core/driver.c drivers/usb/host/xhci-hub.c drivers/usb/serial/qcserial.c mm/memory_hotplug.c Change-Id: Ib35ff60e426c13224f3287b5240237634fda4574
| * | deb-pkg: Fix cross-building linux-headers packageBen Hutchings2014-03-301-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit f8ce239dfc7ba9add41d9ecdc5e7810738f839fa upstream. builddeb generates a control file that says the linux-headers package can only be built for the build system primary architecture. This breaks cross-building configurations. We should use $debarch for this instead. Since $debarch is not yet set when generating the control file, set Architecture: any and use control file variables to fill in the description. Fixes: cd8d60a20a45 ('kbuild: create linux-headers package in deb-pkg') Reported-and-tested-by: "Niew, Sh." <shniew@gmail.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | Merge tag 'v3.4.82' into cm-11.0dhacker292014-03-131-2/+2
|\| | | | | | | | | | | This is the 3.4.82 stable release
| * | Modpost: fixed USB alias generation for ranges including 0x9 and 0xAJan Moskyto Matejka2014-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 03b56329f9bb5a1cb73d7dc659d529a9a9bf3acc upstream. Commit afe2dab4f6 ("USB: add hex/bcd detection to usb modalias generation") changed the routine that generates alias ranges. Before that change, only digits 0-9 were supported; the commit tried to fix the case when the range includes higher values than 0x9. Unfortunately, the commit didn't fix the case when the range includes both 0x9 and 0xA, meaning that the final range must look like [x-9A-y] where x <= 0x9 and y >= 0xA -- instead the [x-9A-x] range was produced. Modprobe doesn't complain as it sees no difference between no-match and bad-pattern results of fnmatch(). Fixing this simple bug to fix the aliases. Also changing the hardcoded beginning of the range to uppercase as all the other letters are also uppercase in the device version numbers. Fortunately, this affects only the dvb-usb-dib0700 module, AFAIK. Signed-off-by: Jan Moskyto Matejka <mq@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | Merge Moto X 4.4 source for 13.11.3Q2.X-69-3-2dhacker292013-12-202-2/+22
| | | | | | | | | | | | Change-Id: I6cc0cb6aa65d237c3f0cd384ce419511d3d3bc2e
* | | Merge tag 'v3.4.66' into cm-10.2dhacker292013-10-181-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the 3.4.66 stable release Conflicts: drivers/usb/host/xhci-plat.c drivers/virtio/virtio_ring.c include/linux/virtio.h include/net/bluetooth/hci_core.h include/net/bluetooth/mgmt.h net/bluetooth/hci_core.c net/bluetooth/hci_event.c net/bluetooth/l2cap_core.c net/bluetooth/mgmt.c
| * | kernel-doc: bugfix - multi-line macrosDaniel Santos2013-10-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 654784284430bf2739985914b65e09c7c35a7273 upstream. Prior to this patch the following code breaks: /** * multiline_example - this breaks kernel-doc */ #define multiline_example( \ myparam) Producing this error: Error(somefile.h:983): cannot understand prototype: 'multiline_example( \ ' This patch fixes the issue by appending all lines ending in a blackslash (optionally followed by whitespace), removing the backslash and any whitespace after it prior to appending (just like the C pre-processor would). This fixes a break in kerel-doc introduced by the additions to rbtree.h. Signed-off-by: Daniel Santos <daniel.santos@pobox.com> Cc: Randy Dunlap <rdunlap@xenotime.net> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | Merge tag 'AU_LINUX_ANDROID_JB_2.6.04.03.00.109.025' into HEADdhacker292013-10-171-0/+20
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AU_LINUX_ANDROID_JB_2.6.04.03.00.109.025 based on quic/aosp/jb_2.6 Conflicts: arch/arm/configs/msm8960_defconfig arch/arm/mach-msm/board-8064-pmic.c arch/arm/mach-msm/board-8930-pmic.c arch/arm/mach-msm/board-8930.c arch/arm/mach-msm/board-8960-camera.c arch/arm/mach-msm/board-8960-pmic.c arch/arm/mach-msm/board-8960.c arch/arm/mach-msm/cache_erp.c arch/arm/mach-msm/pm-8x60.c arch/arm/mach-msm/spm_devices.c arch/arm/mach-msm/subsystem_restart.c arch/arm/mm/dma-mapping.c drivers/char/diag/diagchar_core.c drivers/char/msm_rotator.c drivers/gpu/msm/adreno.c drivers/gpu/msm/adreno.h drivers/gpu/msm/adreno_drawctxt.h drivers/gpu/msm/kgsl.c drivers/gpu/msm/kgsl_events.c drivers/gpu/msm/kgsl_iommu.c drivers/gpu/msm/kgsl_sharedmem.c drivers/gpu/msm/kgsl_sync.c drivers/hwmon/epm_adc.c drivers/media/video/msm/gemini/msm_gemini_hw.c drivers/media/video/msm/msm.c drivers/media/video/msm/msm.h drivers/media/video/msm/msm_mctl.c drivers/media/video/msm/server/msm_cam_server.c drivers/media/video/msm/vfe/msm_vfe32.c drivers/mmc/core/core.c drivers/mmc/core/core.h drivers/mmc/core/mmc.c drivers/mmc/host/msm_sdcc.c drivers/net/wireless/wcnss/wcnss_riva.c drivers/net/wireless/wcnss/wcnss_wlan.c drivers/power/pm8921-bms.c drivers/power/pm8921-charger.c drivers/spi/spi_qsd.c drivers/thermal/pm8xxx-tm.c drivers/tty/serial/msm_serial_hs.c drivers/usb/gadget/ci13xxx_udc.c drivers/video/msm/mdp.c drivers/video/msm/mdp4.h drivers/video/msm/mdp4_overlay.c drivers/video/msm/mdp4_overlay_dsi_cmd.c drivers/video/msm/mdp4_overlay_dsi_video.c drivers/video/msm/mdp4_overlay_dtv.c drivers/video/msm/mipi_dsi.c drivers/video/msm/mipi_dsi_host.c drivers/video/msm/msm_fb.c drivers/video/msm/vidc/1080p/ddl/vcd_ddl_metadata.c drivers/video/msm/vidc/common/init/vidc_init.c include/linux/mfd/pm8xxx/pm8921-charger.h include/linux/msm_rotator.h include/linux/nl80211.h include/linux/wcnss_wlan.h include/media/msm_camera.h include/video/msm_hdmi_modes.h kernel/signal.c scripts/gcc-wrapper.py sound/soc/msm/msm-pcm-routing.c sound/soc/msm/msm-pcm-routing.h sound/soc/msm/msm8960.c
| * | treat these errors as warnings.Aparna Mallavarapu2013-05-271-0/+20
| | | | | | | | | | | | | | | Change-Id: Ic3e89274e3c871f8b789550f5e15c2b2b5be9b1c Signed-off-by: Supreet Mysore Suresh <supreet@codeaurora.org>
* | | scripts: Don't force a variant defconfig to be requireddhacker292013-08-231-5/+0
| | |
* | | scripts: Add support for variant and selinux defconfigdhacker292013-08-234-7/+73
| | |
* | | Overlay Ultra 3.4.42 open source drop from Motoroladhacker292013-08-233-1/+9
| | |
* | | Merge tag 'v3.4.42' into HEADdhacker292013-08-228-15/+17
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the 3.4.42 stable release Conflicts: arch/arm/Kconfig arch/arm/include/asm/mutex.h arch/arm/kernel/traps.c arch/arm/mm/mmu.c arch/arm/mm/tlb-v7.S arch/arm/vfp/entry.S arch/arm/vfp/vfpmodule.c drivers/base/power/main.c drivers/bluetooth/ath3k.c drivers/bluetooth/btusb.c drivers/gpu/drm/radeon/radeon_mode.h drivers/mmc/card/block.c drivers/mmc/host/sdhci.c drivers/net/tun.c drivers/usb/core/hub.c drivers/usb/core/message.c drivers/usb/host/xhci.h fs/ubifs/dir.c include/linux/sched.h kernel/cgroup.c kernel/power/suspend.c kernel/signal.c net/bluetooth/hci_conn.c net/bluetooth/hci_event.c net/bluetooth/l2cap_core.c net/bluetooth/mgmt.c net/bluetooth/rfcomm/sock.c net/bluetooth/smp.c
| * kbuild: Do not package /boot and /lib in make tar-pkgMichal Marek2012-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit fe04ddf7c2910362f3817c8156e41cbd6c0ee35d upstream. There were reports of users destroying their Fedora installs by a kernel tarball that replaces the /lib -> /usr/lib symlink. Let's remove the toplevel directories from the tarball to prevent this from happening. Reported-by: Andi Kleen <andi@firstfloor.org> Suggested-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Michal Marek <mmarek@suse.cz> [bwh: Fold in commit 3ce9e53e788881da0d5f3912f80e0dd6b501f304 to avoid conflicts] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * localmodconfig: Fix localyesconfig to set to 'y' not 'm'Yuta Ando2012-10-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 4eae518d4b01b0cbf2f0d8edb5a6f3d6245ee8fb upstream. The kbuild target 'localyesconfig' has been same as 'localmodconfig' since the commit 50bce3e "kconfig/streamline_config.pl: merge local{mod,yes}config". The commit expects this script generates different configure depending on target, but it was not yet implemented. So I added code that sets to 'yes' when target is 'localyesconfig'. Link: http://lkml.kernel.org/r/1349101470-12243-1-git-send-email-yuta.and@gmail.com Signed-off-by: Yuta Ando <yuta.and@gmail.com> Cc: linux-kbuild@vger.kernel.org Signed-off-by: Steven Rostedt <rostedt@rostedt.homelinux.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * kbuild: Fix gcc -x syntaxJean Delvare2012-10-136-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit b1e0d8b70fa31821ebca3965f2ef8619d7c5e316 upstream. The correct syntax for gcc -x is "gcc -x assembler", not "gcc -xassembler". Even though the latter happens to work, the former is what is documented in the manual page and thus what gcc wrappers such as icecream do expect. This isn't a cosmetic change. The missing space prevents icecream from recognizing compilation tasks it can't handle, leading to silent kernel miscompilations. Besides me, credits go to Michael Matz and Dirk Mueller for investigating the miscompilation issue and tracking it down to this incorrect -x parameter syntax. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: Ingo Molnar <mingo@kernel.org> Cc: Bernhard Walle <bernhard@bwalle.de> Cc: Michal Marek <mmarek@suse.cz> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * kbuild: make: fix if_changed when command contains backslashesSascha Hauer2012-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit c353acba28fb3fa1fd05fd6b85a9fc7938330f9c upstream. The call if_changed mechanism does not work when the command contains backslashes. This basically is an issue with lzo and bzip2 compressed kernels. The compressed binaries do not contain the uncompressed image size, so these use size_append to append the size. This results in backslashes in the executed command. With this if_changed always detects a change in the command and rebuilds the compressed image even if nothing has changed. Fix this by escaping backslashes in make-cmd Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Bernhard Walle <bernhard@bwalle.de> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | Merge "USB: allow match on bInterfaceNumber"Linux Build Service Account2013-02-121-1/+4
|\ \
| * | USB: allow match on bInterfaceNumberBjørn Mork2013-02-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From 81df2d594340dcb6d1a02191976be88a1ca8120c upstream. Some composite USB devices provide multiple interfaces with different functions, all using "vendor-specific" for class/subclass/protocol. Another OS use interface numbers to match the driver and interface. It seems these devices are designed with that in mind - using static interface numbers for the different functions. This adds support for matching against the bInterfaceNumber, allowing such devices to be supported without having to resort to testing against interface number whitelists and/or blacklists in the probe. Change-Id: I0f991e507d041bbe12aa87403b9c2e1f0de274c2 Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | Update copyright to The Linux FoundationDuy Truong2013-02-122-4/+4
|/ / | | | | | | | | Change-Id: Ibead64ce2e901dede2ddd1b86088b88f2350ce92 Signed-off-by: Duy Truong <dtruong@codeaurora.org>
* | checkpatch: Excuse reverts from "summary line over 75 characters" checkMatt Wagantall2012-11-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Rather than forcing authors of reverts to truncate the summary line because the "Revert" prefix added pushes it over the character limit, excuse reverts from this rule. Change-Id: I395dfff3327e360ef935d4a685c38df6577e3867 Signed-off-by: Matt Wagantall <mattw@codeaurora.org> (cherry picked from commit 3c09aeb415d542b08257021992aadd965fcb3902) Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org> (cherry picked from commit 952824addcec8487b8c800b0ef18ede547711381)
* | checkpatch: strlen and strcmp should not be bannedDavid Brown2012-07-161-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Software security is an important issue, in general, but it is especially important in Linux kernel code. Buffer overflows can have wide-reaching ramifications and can often be readily exploited to compromise the entire system. It is important for every developer to be aware of security issues while writing code. However, I've noticed a few "rules" about coding that are resulting in code that isn't any more secure, and has the disadvantage of obscuring what the code is doing. In most instances, the "corrected" code is actually wrong: we've traded a perceived lack of safety for incorrect behavior. These obfuscations also make this code more distant from upstream kernel standards. I'm only going to focus here on strcmp/strncmp and strlen/strnlen. I choose these two, because in the context of the kernel, it's not easy to make a general rule, such as "always use the 'n' variant". These function have different behavior, and the 'n' isn't just a blanket fix that makes them better. In many instances, the correct call is the plain variant (strcpy has a strlcpy variant which is usually helpful). Let's start with strlen/strnlen. size_t strlen(const char *); size_t strnlen(const char *, size_t); The strlen() function scans for a NUL byte within a string, and returns the number of characters that had to be skipped to get there. The strnlen() call is similar, but will stop after after a maximal number of characters, and return that result. This variant was intended for storing variable length strings in fixed-sized buffers, where the full-length case did not have a trailing NUL. This storage model is very uncommon, as is the use of strnlen(). The question becomes, what is the maximal length you should be giving to strnlen(). If the string is truly variable length (allocated and filled), there really isn't a meaningful value to use for this. The only time that a max length makes sense is when you have something like: char name[MAX_NAME_LENGTH]; but, in this case, strnlen() is still probably not what you want to be using. It would be safe to use, if you check the result, and if it is MAX_NAME_LENGTH, raise some kind of error case. If later code assumes there is a NUL at the end, there will still be a buffer overflow. In this case, it is much better to check the length before storing it in this field, and make sure there is room for the NUL. If the string is a constant, passing in a length doesn't make sense, since you would have to know the length of the string to check that. There is no safety issue with calling strlen() on a constant. So, the simple rule for strnlen()/strlen() is: - If the string doesn't have an obvious bound length, such as an allocated string, use strlen(). - If the string is a constant, use strlen(). - If there is a fixed buffer, strnlen() might make sense, but it is probably better to change the design to avoid these types of strings. The only case where strnlen really makes sense is when you have a string that is passed in from the user. In this case, it is very important to check the result, and if the length is at the maximum, return an error, and don't try to do any processing on the string. Moving on to strcmp/strncmp. These functions are similar, except that they take two string arguments, which gives a lot more combinations. int strcmp(const char *, const char *); int strncmp(const char *, const char *, size_t); These will walk both strings (at the same time), and stop when reaching the first difference between them. This means that they will never go further than the length of the shortest string being compared. As in strnlen, the max argument to strncmp sets a limit on the comparison. Similar to strnlen, the results are unusual when the limit is reached, but in a sense, even worse, since it may consider the strings equal without ever reaching the end of either. Looking over the 200 some uses of strncmp in the msm code, almost all of them do something akin to: strncmp(value, constant, strlen(constant)) If the call has added 1 to the 'strlen' result, the strncmp would just become an inefficient, but otherwise identical version of strcmp. However, without the +1, this compares the prefix of 'value' instead of the entire string. Only one instance of strncmp in the code appears to be intentionally checking for a prefix. The rest have changed a simple string compare into an unintentional prefix match. Because there are two strings, it is a little more complex to determine which to use, but it is very similar. It might seem that strncmp() would be useful for checking an unknown buffer (say from userspace). However, since strncmp()'s result doesn't distinguish between finding the end of the string, or hitting the max, there's no way to know. Some guidelines: - If one of the strings has a known bound length (such as a constant, or another string whose length has already been checked), AND this bound length is within the expected buffer of the other string, it is safe to use strcmp(). - Otherwise, you may need to use something like strnlen() to determine a maximum length before calling strcmp(). - strncmp() is useful to test a string for a prefix. No other uses make sense. To facilitate fixing these, remove strlen(), strcmp(), and strcasecmp() from the list of calls that are banned. Problems with these calls need to be caught at a higher level (such as review), and replacing them with the 'n' variants doesn't help anything. This will be followed by some patches that fixup the incorrect code introduced by this "ban". Change-Id: I77dfe1f2f58e8c951e4b38b23f4ec79f8209b1dc Signed-off-by: David Brown <davidb@codeaurora.org>
* | checkpatch: add new message type stringSteve Muckle2012-06-131-22/+40
| | | | | | | | | | | | | | | | | | Many messsages are missing the new message type parameter, which causes warning messages and a lack of the line number from the offending line in the patch. Change-Id: I69f2283c3dc27edd66fd2676c8be45664699dba6 Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
* | scripts: gcc-wrapper: Add an allowed warning for alignment.cSridhar Parasuram2012-06-111-1/+2
| | | | | | | | | | | | | | | | | | | | | kernel/arch/arm/mm/alignment.c:327:15: warning: 'offset.un' may be used uninitialized in this function [-Wuninitialized] | error, forbidden warning: alignment.c:327 | make[2]: *** [arch/arm/mm/alignment.o] Error 1 Change-Id: Iadba4720a38997682036527a89b5adeb52ea6119 Signed-off-by: Sridhar Parasuram <sridhar@codeaurora.org>
* | Merge commit 'AU_LINUX_ANDROID_ICS.04.00.04.00.126' into msm-3.4Steve Muckle2012-06-066-17/+675
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AU_LINUX_ANDROID_ICS.04.00.04.00.126 from msm-3.0. First parent is from google/android-3.4. * commit 'AU_LINUX_ANDROID_ICS.04.00.04.00.126': (8712 commits) PRNG: Device tree entry for qrng device. vidc:1080p: Set video core timeout value for Thumbnail mode msm: sps: improve the debugging support in SPS driver board-8064 msm: Overlap secure and non secure video firmware heaps. msm: clock: Add handoff ops for 7x30 and copper XO clocks msm_fb: display: Wait for external vsync before DTV IOMMU unmap msm: Fix ciruclar dependency in debug UART settings msm: gdsc: Add GDSC regulator driver for msm-copper defconfig: Enable Mobicore Driver. mobicore: Add mobicore driver. mobicore: rename variable to lower case. mobicore: rename folder. mobicore: add makefiles mobicore: initial import of kernel driver ASoC: msm: Add SLIMBUS_2_RX CPU DAI board-8064-gpio: Update FUNC for EPM SPI CS msm_fb: display: Remove chicken bit config during video playback mmc: msm_sdcc: enable the sanitize capability msm-fb: display: lm2 writeback support on mpq platfroms msm_fb: display: Disable LVDS phy & pll during panel off ... Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
| * mmc: block: Add MMC write packing statisticsMaya Erez2012-06-041-2/+2
| | | | | | | | | | | | | | | | The write packing statistics are used for the packed commands unit tests in order to determine test success or failure Change-Id: I1b330033e59a775c64fb915038d58615aff0dbdd Signed-off-by: Maya Erez <merez@codeaurora.org>
| * mmc: block: Add write packing controlMaya Erez2012-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The write packing control will ensure that read requests latency is not increased due to long write packed commands. The trigger for enabling the write packing is managing to pack several write requests. The number of potential packed requests that will trigger the packing can be configured via sysfs by writing the required value to: /sys/block/<block_dev_name>/num_wr_reqs_to_start_packing. The trigger for disabling the write packing is fetching a read request. Change-Id: I982170fa6dca9150ea4310bb546b838b7fd30e9b Signed-off-by: Maya Erez <merez@codeaurora.org>
| * mmc: core: Support packed write command for eMMC4.5 deviceSeungwon Jeon2012-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | This patch supports packed write command of eMMC4.5 device. Several writes can be grouped in packed command and all data of the individual commands can be sent in a single transfer on the bus. Change-Id: I391c3e5f73b785a8b7d25eb8256051020cfb0631 Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Maya Erez <merez@codeaurora.org>
| * modpost: fix ALL_INIT_DATA_SECTIONSJan Beulich2012-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | This was lacking a comma between two supposed to be separate strings. Change-Id: Ic49ee7d848d294823b59ffb3a6f49353f21cbe21 Signed-off-by: Jan Beulich <jbeulich@suse.com> Cc: <stable@vger.kernel.org> Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
| * ARM: 7324/1: modpost: Fix section warnings for ARM for many compilersTony Lindgren2012-05-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that many compilers don't show section warnings on ARM currently because handling for ARM_CALL relocs are missing from modpost.c. Based on commit c2e26114 ([ARM] 3205/1: Handle new EABI relocations when loading kernel modules) it seems that R_ARM_PC24, R_ARM_CALL and R_ARM_JUMP24 can be handled the same way. Note that at least Debian libc6-dev is missing defines for both R_ARM_CALL and R_ARM_JUMP24 in /usr/include/elf.h. So for now we need to define them in modpost.c if not defined. Change-Id: Ib059548c9725885ebdc0db6b7844e407ff012dec Acked-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Ben Hutchings <ben@decadent.org.uk> Cc: Anders Kaseorg <andersk@ksplice.com> Cc: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
| * Merge branch 'Linux 3.0.21' into msm-3.0Rohit Vaswani2012-03-303-17/+44
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge Upstream's stable 3.0.21 branch into msm-3.0 This consists 814 commits and some merge conflicts. The merge conflicts are because of some local changes to msm-3.0 as well as some conflicts between google's tree and the upstream tree. Conflicts: arch/arm/kernel/head.S drivers/bluetooth/ath3k.c drivers/bluetooth/btusb.c drivers/mmc/core/core.c drivers/tty/serial/serial_core.c drivers/usb/host/ehci-hub.c drivers/usb/serial/qcserial.c fs/namespace.c fs/proc/base.c Change-Id: I62e2edbe213f84915e27f8cd6e4f6ce23db22a21 Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
| | * recordmcount: Fix handling of elf64 big-endian objects.David Daney2012-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 2e885057b7f75035f0b85e02f737891482815a81 upstream. In ELF64, the sh_flags field is 64-bits wide. recordmcount was erroneously treating it as a 32-bit wide field. For little endian objects this works because the flags of interest (SHF_EXECINSTR) reside in the lower 32 bits of the word, and you get the same result with either a 32-bit or 64-bit read. Big endian objects on the other hand do not work at all with this error. The fix: Correctly treat sh_flags as 64-bits wide in elf64 objects. The symptom I observed was that my __start_mcount_loc..__stop_mcount_loc was empty even though ftrace function tracing was enabled. Link: http://lkml.kernel.org/r/1324345362-12230-1-git-send-email-ddaney.cavm@gmail.com Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| | * kconfig/streamline-config.pl: Fix parsing Makefile with variablesSteven Rostedt2012-01-251-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 364212fddaaa60c5a64f67a0f5624ad996ecc8a0 upstream. Thomas Lange reported that when he did a 'make localmodconfig', his config was missing the brcmsmac driver, even though he had the module loaded. Looking into this, I found the file: drivers/net/wireless/brcm80211/brcmsmac/Makefile had the following in the Makefile: MODULEPFX := brcmsmac obj-$(CONFIG_BRCMSMAC) += $(MODULEPFX).o The way streamline-config.pl works, is parsing all the obj-$(CONFIG_FOO) += foo.o lines to find that CONFIG_FOO belongs to the module foo.ko. But in this case, the brcmsmac.o was not used, but a variable in its place. By changing streamline-config.pl to remember defined variables in Makefiles and substituting them when they are used in the obj-X lines, allows Thomas (and others) to have their brcmsmac module stay configured when it is loaded and running "make localmodconfig". Reported-by: Thomas Lange <thomas-lange2@gmx.de> Tested-by: Thomas Lange <thomas-lange2@gmx.de> Cc: Arend van Spriel <arend@broadcom.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| | * kconfig/streamline-config.pl: Simplify backslash line concatinationSteven Rostedt2012-01-251-13/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit d060d963e88f3e990cec2fe5214de49de9a49eca upstream. Simplify the way lines ending with backslashes (continuation) in Makefiles is parsed. This is needed to implement a necessary fix. Tested-by: Thomas Lange <thomas-lange2@gmx.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| | * kbuild: Fix help text not displayed in choice option.Srinivas Kandagatla2011-11-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 3f198dfee49d2e9c30583c62b0c79286c78c7b44 upstream. Help text under choice menu is never displayed because it does not have symbol name associated with it, however many kconfigs have help text under choice, assuming that it will be displayed when user selects help. for example in Kconfig if we have: choice prompt "Choice" ---help--- HELP TEXT ... config A bool "A" config B bool "B" endchoice Without this patch "HELP TEXT" is not displayed when user selects help option when "Choice" is highlighted from menuconfig or xconfig or gconfig. This patch changes the logic in menu_get_ext_help to display help for cases which dont have symbol names like choice. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Reviewed-by: Stuart Menefy <stuart.menefy@st.com> Reviewed-by: Arnaud Lacombe <lacombar@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * | setlocalversion: Fix version when built/synced on a tagStephen Boyd2012-03-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If building on a tag we check to make sure the version in the Makefile matches the tag we're building at. That would be a string comparison and not an integer comparison. Change the test accordingly. Right now we'll just see 3.0.8 or 3.0.8-dirty if the kernel is built on a tag. Similarly if we're synced to a tag we may have two references to the same object, 1 in the local repo and one in the remote. Force the show-ref to only look at tags so we only ever describe on ref instead of two. Change-Id: I694947b434db8f95d4c0b9f6e68702c65a1ee281 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
| * | Merge "setlocalversion: Prevent tags from overflowing version string" into ↵Linux Build Service Account2012-03-171-11/+25
| |\ \ | | | | | | | | | | | | msm-3.0
| | * | setlocalversion: Prevent tags from overflowing version stringStephen Boyd2012-03-121-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some post Linus tags are very long and they exceed the character limit on the version string. This leads to compile errors like 3.0.8-insert-your-reallllly-long-tag-name-here-13-g4b4e960-dirty exceeds 64 characters Instead of putting the pretty printed name of the closest post Linus tag, place the tag's object hash in the version string. This should allow developers to easily run a git show on the first hash to see what tag the build is based on. The version will look like: 3.0.8-gb080168-00006-g41f3bb3-dirty meaning the kernel is based on v3.0.8 at the tag b080168 with 6 patches applied on top of that tag resulting in a commit with the hash 41f3bb3 plus a dirty tree. Running "git show b080168" should show the closest tag the tree was based on. Change-Id: I8a26532f76aadf31654cb420ab789e90bd2fe828 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
| * | | checkpatch: Check for unsafe string functionsOlav Haugan2012-03-121-2/+5
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are many string based functions that are unsafe to use. Some of the functions are unsafe to use because of the possibility of overflow while others cannot guarantee that the resultant string is NULL-terminated. Add check for these functions and log message indicating which safe functions can be used instead. Change-Id: Id305d98df241e3fd257529529739dcd4f3659186 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
| * | checkpatch: recognize only specific tags when ending commit textSteve Muckle2012-03-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | There are some very frequently used tags that checkpatch can look for as an ending to the commit text rather than using a pattern, which can generate false positives in the "no commit text" rule. Change-Id: I5b4400017b8273bcd9f5a59b3e28965c0062bef4 Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
| * | Merge "setlocalversion: Include post Linus git tags in LOCALVERSION_AUTO" ↵Linux Build Service Account2012-03-071-9/+10
| |\ \ | | | | | | | | | | | | into msm-3.0
| | * | setlocalversion: Include post Linus git tags in LOCALVERSION_AUTOStephen Boyd2012-02-221-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The localversion detection script assumes that if there's a tag describing the commit the toplevel Makefile would indicate what that version is. This is usually true because Linus tags a commit and updates the Makefile at the same time to make a release. Unfortunately this means that any other tags made on the kernel are ignored and not used in the localversion output. For example, consider Linus tagged v3.0-rc5 and I have worked on a bunch of commits based off that tag and then tagged my branch with another tag called "changes-for-linus". Ideally I would like to see the kernel is based off v3.0-rc5 at the tag changes-for-linus. When localversion detects the version it assumes that the kernel is v3.0-rc5 because a tag is on the current commit but it doesn't confirm that the tag matches the Makefile. It then proceeds to throw away everything after the patch level and git commit hash from git describe output so we lost the tag changes-for-linus and are left with: v3.0-rc5-0003-g234ad Instead of doing that always try to describe the tree regardless of whether or not there is an exact match (unless we are doing --short output and just want to put a + after the version). Always include the tag so that we get a bit more information about the tree that was built, but be sure to throw away any tags from Linus himself that start with v3.* so that we get output like: v3.0-rc5-changes-for-linus-0003-g234ad Change-Id: I9c4d03c61650658676f221680c61899305c6217a Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>