17 Nov, 2011

1 commit


01 Nov, 2011

2 commits

  • As suggested by Andrew Morton in [1] there is better to have most
    significant part first in the function name.

    [1] https://lkml.org/lkml/2011/9/20/22

    There is no functional change.

    Signed-off-by: Andy Shevchenko
    Cc: Jesper Nilsson
    Cc: David Howells
    Cc: Koichi Yasutake
    Cc: Jason Wessel
    Cc: Mimi Zohar
    Cc: James Morris
    Cc: OGAWA Hirofumi
    Cc: "John W. Linville"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     
  • Currently termination logic (\0 or \n\0) is hardcoded in _kstrtoull(),
    avoid that for code reuse between kstrto*() and simple_strtoull().
    Essentially, make them different only in termination logic.

    simple_strtoull() (and scanf(), BTW) ignores integer overflow, that's a
    bug we currently don't have guts to fix, making KSTRTOX_OVERFLOW hack
    necessary.

    Almost forgot: patch shrinks code size by about ~80 bytes on x86_64.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

26 Jul, 2011

2 commits

  • * Merge akpm patch series: (122 commits)
    drivers/connector/cn_proc.c: remove unused local
    Documentation/SubmitChecklist: add RCU debug config options
    reiserfs: use hweight_long()
    reiserfs: use proper little-endian bitops
    pnpacpi: register disabled resources
    drivers/rtc/rtc-tegra.c: properly initialize spinlock
    drivers/rtc/rtc-twl.c: check return value of twl_rtc_write_u8() in twl_rtc_set_time()
    drivers/rtc: add support for Qualcomm PMIC8xxx RTC
    drivers/rtc/rtc-s3c.c: support clock gating
    drivers/rtc/rtc-mpc5121.c: add support for RTC on MPC5200
    init: skip calibration delay if previously done
    misc/eeprom: add eeprom access driver for digsy_mtc board
    misc/eeprom: add driver for microwire 93xx46 EEPROMs
    checkpatch.pl: update $logFunctions
    checkpatch: make utf-8 test --strict
    checkpatch.pl: add ability to ignore various messages
    checkpatch: add a "prefer __aligned" check
    checkpatch: validate signature styles and To: and Cc: lines
    checkpatch: add __rcu as a sparse modifier
    checkpatch: suggest using min_t or max_t
    ...

    Did this as a merge because of (trivial) conflicts in
    - Documentation/feature-removal-schedule.txt
    - arch/xtensa/include/asm/uaccess.h
    that were just easier to fix up in the merge than in the patch series.

    Linus Torvalds
     
  • This function is required by *printf and kstrto* functions that are
    located in the different modules. This patch makes _tolower() public.
    However, it's good idea to not use the helper outside of mentioned
    functions.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Andy Shevchenko
    Acked-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     

15 Jul, 2011

1 commit


10 Jun, 2011

1 commit


25 May, 2011

1 commit


24 May, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    b43: fix comment typo reqest -> request
    Haavard Skinnemoen has left Atmel
    cris: typo in mach-fs Makefile
    Kconfig: fix copy/paste-ism for dell-wmi-aio driver
    doc: timers-howto: fix a typo ("unsgined")
    perf: Only include annotate.h once in tools/perf/util/ui/browsers/annotate.c
    md, raid5: Fix spelling error in comment ('Ofcourse' --> 'Of course').
    treewide: fix a few typos in comments
    regulator: change debug statement be consistent with the style of the rest
    Revert "arm: mach-u300/gpio: Fix mem_region resource size miscalculations"
    audit: acquire creds selectively to reduce atomic op overhead
    rtlwifi: don't touch with treewide double semicolon removal
    treewide: cleanup continuations and remove logging message whitespace
    ath9k_hw: don't touch with treewide double semicolon removal
    include/linux/leds-regulator.h: fix syntax in example code
    tty: fix typo in descripton of tty_termios_encode_baud_rate
    xtensa: remove obsolete BKL kernel option from defconfig
    m68k: fix comment typo 'occcured'
    arch:Kconfig.locks Remove unused config option.
    treewide: remove extra semicolons
    ...

    Linus Torvalds
     

13 May, 2011

1 commit

  • kptr_restrict has been triggering bugs in apps such as perf, and it also makes
    the system less useful by default, so turn it off by default.

    This is how we generally handle security features that remove functionality,
    such as firewall code or SELinux - they have to be configured and activated
    from user-space.

    Distributions can turn kptr_restrict on again via this line in
    /etc/sysctrl.conf:

    kernel.kptr_restrict = 1

    ( Also mark the variable __read_mostly while at it, as it's typically modified
    only once per bootup, or not at all. )

    Signed-off-by: Ingo Molnar
    Acked-by: David S. Miller
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

26 Apr, 2011

1 commit


06 Apr, 2011

1 commit


26 Mar, 2011

1 commit


24 Mar, 2011

1 commit

  • The %pB format specifier is for stack backtrace. Its handler
    sprint_backtrace() does symbol lookup using (address-1) to
    ensure the address will not point outside of the function.

    If there is a tail-call to the function marked "noreturn",
    gcc optimized out the code after the call then causes saved
    return address points outside of the function (i.e. the start
    of the next function), so pollutes call trace somewhat.

    This patch adds the %pB printk mechanism that allows architecture
    call-trace printout functions to improve backtrace printouts.

    Signed-off-by: Namhyung Kim
    Acked-by: Steven Rostedt
    Acked-by: Frederic Weisbecker
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Cc: linux-arch@vger.kernel.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Namhyung Kim
     

23 Mar, 2011

3 commits

  • 1. simple_strto*() do not contain overflow checks and crufty,
    libc way to indicate failure.
    2. strict_strto*() also do not have overflow checks but the name and
    comments pretend they do.
    3. Both families have only "long long" and "long" variants,
    but users want strtou8()
    4. Both "simple" and "strict" prefixes are wrong:
    Simple doesn't exactly say what's so simple, strict should not exist
    because conversion should be strict by default.

    The solution is to use "k" prefix and add convertors for more types.
    Enter
    kstrtoull()
    kstrtoll()
    kstrtoul()
    kstrtol()
    kstrtouint()
    kstrtoint()

    kstrtou64()
    kstrtos64()
    kstrtou32()
    kstrtos32()
    kstrtou16()
    kstrtos16()
    kstrtou8()
    kstrtos8()

    Include runtime testsuite (somewhat incomplete) as well.

    strict_strto*() become deprecated, stubbed to kstrto*() and
    eventually will be removed altogether.

    Use kstrto*() in code today!

    Note: on some archs _kstrtoul() and _kstrtol() are left in tree, even if
    they'll be unused at runtime. This is temporarily solution,
    because I don't want to hardcode list of archs where these
    functions aren't needed. Current solution with sizeof() and
    __alignof__ at least always works.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • In an effort to reduce kernel address leaks that might be used to help
    target kernel privilege escalation exploits, this patch uses %pK when
    displaying addresses in /proc/kallsyms, /proc/modules, and
    /sys/module/*/sections/*.

    Note that this changes %x to %p, so some legitimately 0 values in
    /proc/kallsyms would have changed from 00000000 to "(null)". To avoid
    this, "(null)" is not used when using the "K" format. Anything that was
    already successfully parsing "(null)" in addition to full hex digits
    should have no problem with this change. (Thanks to Joe Perches for the
    suggestion.) Due to the %x to %p, "void *" casts are needed since these
    addresses are already "unsigned long" everywhere internally, due to their
    starting life as ELF section offsets.

    Signed-off-by: Kees Cook
    Cc: Eugene Teo
    Cc: Dan Rosenberg
    Cc: Rusty Russell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • If kptr restrictions are on, just set the passed pointer to NULL.

    $ size lib/vsprintf.o.*
    text data bss dec hex filename
    8247 4 2 8253 203d lib/vsprintf.o.new
    8282 4 2 8288 2060 lib/vsprintf.o.old

    Signed-off-by: Joe Perches
    Cc: Dan Rosenberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

14 Jan, 2011

2 commits

  • vscnprintf() should return 0 if @size is == 0. Update the comment for it,
    as @size is unsigned.

    This change based on the code of commit
    b903c0b8899b46829a9b80ba55b61079b35940ec ("lib: fix scnprintf() if @size
    is == 0") moves the real fix into vscnprinf() from scnprintf() and makes
    scnprintf() call vscnprintf(), thus avoid code duplication.

    Signed-off-by: Anton Arapov
    Acked-by: Changli Gao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Anton Arapov
     
  • Add the %pK printk format specifier and the /proc/sys/kernel/kptr_restrict
    sysctl.

    The %pK format specifier is designed to hide exposed kernel pointers,
    specifically via /proc interfaces. Exposing these pointers provides an
    easy target for kernel write vulnerabilities, since they reveal the
    locations of writable structures containing easily triggerable function
    pointers. The behavior of %pK depends on the kptr_restrict sysctl.

    If kptr_restrict is set to 0, no deviation from the standard %p behavior
    occurs. If kptr_restrict is set to 1, the default, if the current user
    (intended to be a reader via seq_printf(), etc.) does not have CAP_SYSLOG
    (currently in the LSM tree), kernel pointers using %pK are printed as 0's.
    If kptr_restrict is set to 2, kernel pointers using %pK are printed as
    0's regardless of privileges. Replacing with 0's was chosen over the
    default "(null)", which cannot be parsed by userland %p, which expects
    "(nil)".

    [akpm@linux-foundation.org: check for IRQ context when !kptr_restrict, save an indent level, s/WARN/WARN_ONCE/]
    [akpm@linux-foundation.org: coding-style fixup]
    [randy.dunlap@oracle.com: fix kernel/sysctl.c warning]
    Signed-off-by: Dan Rosenberg
    Signed-off-by: Randy Dunlap
    Cc: James Morris
    Cc: Eric Dumazet
    Cc: Thomas Graf
    Cc: Eugene Teo
    Cc: Kees Cook
    Cc: Ingo Molnar
    Cc: David S. Miller
    Cc: Peter Zijlstra
    Cc: Eric Paris

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Rosenberg
     

27 Oct, 2010

2 commits

  • scnprintf() should return 0 if @size is == 0. Update the comment for it,
    as @size is unsigned.

    Signed-off-by: Changli Gao
    Cc: Ingo Molnar
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Changli Gao
     
  • It might be nicer to align the output.

    For instance, ACPI messages sometimes have "(null)" pointers.

    $ dmesg | grep "(null)" -A 1 -B 1
    [ 0.198733] ACPI: Dynamic OEM Table Load:
    [ 0.198745] ACPI: SSDT (null) 00239 (v02 PmRef Cpu0Ist 00003000 INTL 20051117)
    [ 0.199294] ACPI: SSDT 7f596e10 001C7 (v02 PmRef Cpu0Cst 00003001 INTL 20051117)
    [ 0.200708] ACPI: Dynamic OEM Table Load:
    [ 0.200721] ACPI: SSDT (null) 001C7 (v02 PmRef Cpu0Cst 00003001 INTL 20051117)
    [ 0.201950] ACPI: SSDT 7f597f10 000D0 (v02 PmRef Cpu1Ist 00003000 INTL 20051117)
    [ 0.203386] ACPI: Dynamic OEM Table Load:
    [ 0.203398] ACPI: SSDT (null) 000D0 (v02 PmRef Cpu1Ist 00003000 INTL 20051117)
    [ 0.203871] ACPI: SSDT 7f595f10 00083 (v02 PmRef Cpu1Cst 00003000 INTL 20051117)
    [ 0.205301] ACPI: Dynamic OEM Table Load:
    [ 0.205315] ACPI: SSDT (null) 00083 (v02 PmRef Cpu1Cst 00003000 INTL 20051117)

    [akpm@linux-foundation.org: add code comment]
    Signed-off-by: Joe Perches
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

10 Aug, 2010

1 commit


05 Jul, 2010

1 commit

  • Add the ability to print a format and va_list from a structure pointer

    Allows __dev_printk to be implemented as a single printk while
    minimizing string space duplication.

    %pV should not be used without some mechanism to verify the
    format and argument use ala __attribute__(format (printf(...))).

    Signed-off-by: Joe Perches
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: David S. Miller

    Joe Perches
     

25 May, 2010

2 commits

  • Mark static functions with noinline_for_stack

    Before:

    akpm:/usr/src/25> objdump -d lib/vsprintf.o | perl scripts/checkstack.pl
    0x00000e82 pointer [vsprintf.o]: 344
    0x0000198c pointer [vsprintf.o]: 344
    0x000025d6 scnprintf [vsprintf.o]: 216
    0x00002648 scnprintf [vsprintf.o]: 216
    0x00002565 snprintf [vsprintf.o]: 208
    0x0000267c sprintf [vsprintf.o]: 208
    0x000030a3 bprintf [vsprintf.o]: 208
    0x00003b1e sscanf [vsprintf.o]: 208
    0x00000608 number [vsprintf.o]: 136
    0x00000937 number [vsprintf.o]: 136

    After:

    akpm:/usr/src/25> objdump -d lib/vsprintf.o | perl scripts/checkstack.pl
    0x00000a7c symbol_string [vsprintf.o]: 248
    0x00000ae8 symbol_string [vsprintf.o]: 248
    0x00002310 scnprintf [vsprintf.o]: 216
    0x00002382 scnprintf [vsprintf.o]: 216
    0x0000229f snprintf [vsprintf.o]: 208
    0x000023b6 sprintf [vsprintf.o]: 208
    0x00002ddd bprintf [vsprintf.o]: 208
    0x00003858 sscanf [vsprintf.o]: 208
    0x00000625 number [vsprintf.o]: 136
    0x00000954 number [vsprintf.o]: 136

    Signed-off-by: Joe Perches
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • - C99 knows about USHRT_MAX/SHRT_MAX/SHRT_MIN, not
    USHORT_MAX/SHORT_MAX/SHORT_MIN.

    - Make SHRT_MIN of type s16, not int, for consistency.

    [akpm@linux-foundation.org: fix drivers/dma/timb_dma.c]
    [akpm@linux-foundation.org: fix security/keys/keyring.c]
    Signed-off-by: Alexey Dobriyan
    Acked-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

25 Apr, 2010

1 commit


15 Apr, 2010

1 commit

  • Commit ef0658f3de484bf9b173639cd47544584e01efa5 changed precision
    from int to s8.

    There is existing kernel code that uses a larger precision.

    An example from the audit code:
    vsnprintf(...,..., " msg='%.1024s'", (char *)data);
    which overflows precision and truncates to nothing.

    Extending precision size fixes the audit system issue.

    Other changes:

    Change the size of the struct printf_spec.type from u16 to u8 so
    sizeof(struct printf_spec) stays as small as possible.
    Reorder the struct members so sizeof(struct printf_spec) remains 64 bits
    without alignment holes.
    Document the struct members a bit more.

    Original-patch-by: Eric Paris
    Signed-off-by: Joe Perches
    Tested-by: Justin P. Mattock
    Signed-off-by: Linus Torvalds

    Joe Perches
     

15 Mar, 2010

2 commits


07 Mar, 2010

3 commits


23 Jan, 2010

1 commit


14 Jan, 2010

1 commit


12 Jan, 2010

1 commit


11 Jan, 2010

1 commit


08 Jan, 2010

1 commit

  • On Mon, 2010-01-04 at 23:43 +0000, Maciej W. Rozycki wrote:
    > The example below shows an address, and the sequence of bits or symbols
    > that would be transmitted when the address is used in the Source Address
    > or Destination Address fields on the MAC header. The transmission line
    > shows the address bits in the order transmitted, from left to right. For
    > IEEE 802 LANs these correspond to actual bits on the medium. The FDDI
    > symbols line shows how the FDDI PHY sends the address bits as encoded
    > symbols.
    >
    > MSB: 35:7B:12:00:00:01
    > Canonical: AC-DE-48-00-00-80
    > Transmission: 00110101 01111011 00010010 00000000 00000000 00000001
    > FDDI Symbols: 35 7B 12 00 00 01"
    >
    > Please note that this address has its group bit clear.
    >
    > This notation is also defined in the "FDDI MEDIA ACCESS CONTROL-2
    > (MAC-2)" (X3T9/92-120) document although that book does not have a need
    > to use the MSB form and it's skipped.

    Adds 6 bytes to object size for x86

    New:
    $ size lib/vsprintf.o
    text data bss dec hex filename
    8664 0 2 8666 21da lib/vsprintf.o
    $ size lib/vsprintf.o
    text data bss dec hex filename
    8658 0 2 8660 21d4 lib/vsprintf.o

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

18 Dec, 2009

1 commit

  • These were added in

    9ac6e44 (lib/vsprintf.c: add %pU to print UUID/GUIDs)
    c7dabef (vsprintf: use %pR, %pr instead of %pRt, %pRf)
    8a27f7c (lib/vsprintf.c: Add "%pI6c" - print pointer as compressed ipv6 address)
    4aa9960 (printk: add %I4, %I6, %i4, %i6 format specifiers)
    dd45c9c (printk: add %pM format specifier for MAC addresses)

    but only added comments to pointer() not vsnprintf() that is refered to by
    printk's comments.

    Signed-off-by: Uwe Kleine-König
    Cc: Harvey Harrison
    Cc: David S. Miller
    Cc: Joe Perches
    Cc: Jens Rosenboom
    Cc: David S. Miller
    Cc: Bjorn Helgaas
    Cc: Jesse Barnes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     

16 Dec, 2009

2 commits

  • UUID/GUIDs are somewhat common in kernel source.

    Standardize the printed style of UUID/GUIDs by using
    another extension to %p.

    %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
    %pUB: 01020304-0506-0708-090A-0B0C0D0E0F10 (upper case)
    %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
    %pUL: 04030201-0605-0807-090A-0B0C0D0E0F10 (upper case)

    %pU defaults to %pUb

    Signed-off-by: Joe Perches
    Cc: Jeff Garzik
    Cc: Tejun Heo
    Cc: Alex Elder
    Cc: Christoph Hellwig
    Cc: Artem Bityutskiy
    Cc: Adrian Hunter
    Cc: Steven Whitehouse
    Cc: Mauro Carvalho Chehab
    Cc: Matt Mackall
    Cc: Neil Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Makes use of skip_spaces() defined in lib/string.c for removing leading
    spaces from strings all over the tree.

    It decreases lib.a code size by 47 bytes and reuses the function tree-wide:
    text data bss dec hex filename
    64688 584 592 65864 10148 (TOTALS-BEFORE)
    64641 584 592 65817 10119 (TOTALS-AFTER)

    Also, while at it, if we see (*str && isspace(*str)), we can be sure to
    remove the first condition (*str) as the second one (isspace(*str)) also
    evaluates to 0 whenever *str == 0, making it redundant. In other words,
    "a char equals zero is never a space".

    Julia Lawall tried the semantic patch (http://coccinelle.lip6.fr) below,
    and found occurrences of this pattern on 3 more files:
    drivers/leds/led-class.c
    drivers/leds/ledtrig-timer.c
    drivers/video/output.c

    @@
    expression str;
    @@

    ( // ignore skip_spaces cases
    while (*str && isspace(*str)) { \(str++;\|++str;\) }
    |
    - *str &&
    isspace(*str)
    )

    Signed-off-by: André Goddard Rosa
    Cc: Julia Lawall
    Cc: Martin Schwidefsky
    Cc: Jeff Dike
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Richard Purdie
    Cc: Neil Brown
    Cc: Kyle McMartin
    Cc: Henrique de Moraes Holschuh
    Cc: David Howells
    Cc:
    Cc: Samuel Ortiz
    Cc: Patrick McHardy
    Cc: Takashi Iwai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    André Goddard Rosa