17 Jul, 2020

1 commit

  • Using uninitialized_var() is dangerous as it papers over real bugs[1]
    (or can in the future), and suppresses unrelated compiler warnings
    (e.g. "unused variable"). If the compiler thinks it is uninitialized,
    either simply initialize the variable or make compiler changes.

    In preparation for removing[2] the[3] macro[4], remove all remaining
    needless uses with the following script:

    git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \
    xargs perl -pi -e \
    's/\buninitialized_var\(([^\)]+)\)/\1/g;
    s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;'

    drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid
    pathological white-space.

    No outstanding warnings were found building allmodconfig with GCC 9.3.0
    for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64,
    alpha, and m68k.

    [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
    [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
    [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
    [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/

    Reviewed-by: Leon Romanovsky # drivers/infiniband and mlx4/mlx5
    Acked-by: Jason Gunthorpe # IB
    Acked-by: Kalle Valo # wireless drivers
    Reviewed-by: Chao Yu # erofs
    Signed-off-by: Kees Cook

    Kees Cook
     

10 May, 2020

1 commit


26 Sep, 2019

1 commit

  • brelse() tests whether its argument is NULL and then returns immediately.
    Thus the test around the call is not needed.

    This issue was detected by using the Coccinelle software.

    Link: http://lkml.kernel.org/r/cfff3b81-fb5d-af26-7b5e-724266509045@web.de
    Signed-off-by: Markus Elfring
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Markus Elfring
     

25 Sep, 2019

1 commit

  • If userspace reads the buffer via blockdev while mounting,
    sb_getblk()+modify can race with buffer read via blockdev.

    For example,

    FS userspace
    bh = sb_getblk()
    modify bh->b_data
    read
    ll_rw_block(bh)
    fill bh->b_data by on-disk data
    /* lost modified data by FS */
    set_buffer_uptodate(bh)
    set_buffer_uptodate(bh)

    Userspace should not use the blockdev while mounting though, the udev
    seems to be already doing this. Although I think the udev should try to
    avoid this, workaround the race by small overhead.

    Link: http://lkml.kernel.org/r/87pnk7l3sw.fsf_-_@mail.parknet.co.jp
    Signed-off-by: OGAWA Hirofumi
    Reported-by: Jan Stancek
    Tested-by: Jan Stancek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

21 May, 2019

1 commit

  • Add SPDX license identifiers to all files which:

    - Have no license information of any form

    - Have EXPORT_.*_SYMBOL_GPL inside which was used in the
    initial scan/conversion to ignore the file

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

06 Jan, 2019

1 commit

  • Merge more updates from Andrew Morton:

    - procfs updates

    - various misc bits

    - lib/ updates

    - epoll updates

    - autofs

    - fatfs

    - a few more MM bits

    * emailed patches from Andrew Morton : (58 commits)
    mm/page_io.c: fix polled swap page in
    checkpatch: add Co-developed-by to signature tags
    docs: fix Co-Developed-by docs
    drivers/base/platform.c: kmemleak ignore a known leak
    fs: don't open code lru_to_page()
    fs/: remove caller signal_pending branch predictions
    mm/: remove caller signal_pending branch predictions
    arch/arc/mm/fault.c: remove caller signal_pending_branch predictions
    kernel/sched/: remove caller signal_pending branch predictions
    kernel/locking/mutex.c: remove caller signal_pending branch predictions
    mm: select HAVE_MOVE_PMD on x86 for faster mremap
    mm: speed up mremap by 20x on large regions
    mm: treewide: remove unused address argument from pte_alloc functions
    initramfs: cleanup incomplete rootfs
    scripts/gdb: fix lx-version string output
    kernel/kcov.c: mark write_comp_data() as notrace
    kernel/sysctl: add panic_print into sysctl
    panic: add options to print system info when panic happens
    bfs: extra sanity checking and static inode bitmap
    exec: separate MM_ANONPAGES and RLIMIT_STACK accounting
    ...

    Linus Torvalds
     

05 Jan, 2019

1 commit

  • This patch introduces 3 new inline functions - is_fat12, is_fat16 and
    is_fat32, and replaces every occurrence in the code in which the FS
    variant (whether this is FAT12, FAT16 or FAT32) was previously checked
    using msdos_sb_info->fat_bits.

    Link: http://lkml.kernel.org/r/1544990640-11604-4-git-send-email-carmeli.tamir@gmail.com
    Signed-off-by: Carmeli Tamir
    Acked-by: OGAWA Hirofumi
    Reviewed-by: Sergey Senozhatsky
    Cc: Johannes Thumshirn
    Cc: Bart Van Assche
    Cc: Martin K. Petersen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Carmeli Tamir
     

04 Jan, 2019

1 commit

  • Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument
    of the user address range verification function since we got rid of the
    old racy i386-only code to walk page tables by hand.

    It existed because the original 80386 would not honor the write protect
    bit when in kernel mode, so you had to do COW by hand before doing any
    user access. But we haven't supported that in a long time, and these
    days the 'type' argument is a purely historical artifact.

    A discussion about extending 'user_access_begin()' to do the range
    checking resulted this patch, because there is no way we're going to
    move the old VERIFY_xyz interface to that model. And it's best done at
    the end of the merge window when I've done most of my merges, so let's
    just get this done once and for all.

    This patch was mostly done with a sed-script, with manual fix-ups for
    the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form.

    There were a couple of notable cases:

    - csky still had the old "verify_area()" name as an alias.

    - the iter_iov code had magical hardcoded knowledge of the actual
    values of VERIFY_{READ,WRITE} (not that they mattered, since nothing
    really used it)

    - microblaze used the type argument for a debug printout

    but other than those oddities this should be a total no-op patch.

    I tried to fix up all architectures, did fairly extensive grepping for
    access_ok() uses, and the changes are trivial, but I may have missed
    something. Any missed conversion should be trivially fixable, though.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

31 Oct, 2018

2 commits

  • Convert the inode timestamp updates to use fat_truncate_time.

    Link: http://lkml.kernel.org/r/2663d3083c4dd62f00b64612c8eaf5542bb05a4c.1538363961.git.sorenson@redhat.com
    Signed-off-by: Frank Sorenson
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Frank Sorenson
     
  • The file namei.c seems to have been renamed to namei_msdos.c, so I decided
    to update the comment with the correct name, and expand it a bit to tell
    the reader what to look for.

    Link: http://lkml.kernel.org/r/20180928194947.23932-1-mihir@cs.utexas.edu
    Signed-off-by: Mihir Mehta
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mihir Mehta
     

23 Aug, 2018

1 commit

  • Now that we pass down 64-bit timestamps from VFS, we just need to convert
    that correctly into on-disk timestamps. To make that work correctly, this
    changes the last use of time_to_tm() in the kernel to time64_to_tm(),
    which also lets use remove that deprecated interfaces.

    Similarly, the time_t use in fat_time_fat2unix() truncates the timestamp
    on the way in, which can be avoided by using types that are wide enough to
    hold the intermediate values during the conversion.

    [hirofumi@mail.parknet.co.jp: remove useless temporary variable, needless long long]
    Link: http://lkml.kernel.org/r/20180619153646.3637529-1-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Acked-by: OGAWA Hirofumi
    Cc: Jeff Layton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

29 Jan, 2018

1 commit


18 Nov, 2017

1 commit

  • The variable slots is being assigned a value of zero that is never read,
    slots is being updated again a few lines later. Remove this redundant
    assignment.

    Cleans clang warning: Value stored to 'slots' is never read

    Link: http://lkml.kernel.org/r/20171017140258.22536-1-colin.king@canonical.com
    Signed-off-by: Colin Ian King
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Colin Ian King
     

28 Sep, 2016

1 commit

  • CURRENT_TIME_SEC is not y2038 safe. current_time() will
    be transitioned to use 64 bit time along with vfs in a
    separate patch.
    There is no plan to transistion CURRENT_TIME_SEC to use
    y2038 safe time interfaces.

    current_time() will also be extended to use superblock
    range checking parameters when range checking is introduced.

    This works because alloc_super() fills in the the s_time_gran
    in super block to NSEC_PER_SEC.

    Signed-off-by: Deepa Dinamani
    Acked-by: Jan Kara
    Signed-off-by: Al Viro

    Deepa Dinamani
     

09 May, 2016

1 commit


23 Jan, 2016

1 commit

  • parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
    inode_foo(inode) being mutex_foo(&inode->i_mutex).

    Please, use those for access to ->i_mutex; over the coming cycle
    ->i_mutex will become rwsem, with ->lookup() done with it held
    only shared.

    Signed-off-by: Al Viro

    Al Viro
     

21 Jan, 2016

1 commit


21 Nov, 2015

1 commit

  • For the root directory, . and .. are faked (using dir_emit_dots()) and
    ctx->pos is reset from 2 to 0.

    A corrupted root directory could cause fat_get_entry() to fail, but
    ->iterate() (fat_readdir()) reports progress to the VFS (with ctx->pos
    rewound to 0), so any following calls to ->iterate() continue to return
    the same entries again and again.

    The result is that userspace will never see the end of the directory,
    causing e.g. 'ls' to hang in a getdents() loop.

    [hirofumi@mail.parknet.co.jp: cleanup and make sure to correct fake_offset]
    Reported-by: Vegard Nossum
    Tested-by: Vegard Nossum
    Signed-off-by: Richard Weinberger
    Signed-off-by: OGAWA Hirofumi
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

17 Apr, 2015

1 commit

  • 'fat.h' includes which includes which
    includes all the header files required for all *.c files fat filesystem.

    [akpm@linux-foundation.org: fs/fat/iode.c needs seq_file.h]
    [sfr@canb.auug.org.au: put one actually necessary include file back]
    Signed-off-by: Alexander Kuleshov
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Kuleshov
     

01 Nov, 2014

1 commit


29 Jun, 2013

1 commit


30 Apr, 2013

1 commit

  • This patch enables rebuilding of directory inodes which are not present in
    the cache.This is done by traversing the disk clusters to find the
    directory entry of the parent directory and using its i_pos to build the
    inode.

    The traversal is done by fat_scan_logstart() which is similar to
    fat_scan() but matches i_pos values instead of names.fat_scan_logstart()
    needs an inode parameter to work, for which a dummy inode is created by
    it's caller fat_rebuild_parent(). This dummy inode is destroyed after the
    traversal completes.

    All this is done only if the nostale_ro nfs mount option is specified.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Ravishankar N
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     

23 Feb, 2013

1 commit


21 Dec, 2012

1 commit

  • fat_search_long() returns 0 on success, -ENOENT/ENOMEM on failure.
    Change the function comment accordingly.

    While at it, fix some trivial typos.

    Signed-off-by: Ravishankar N
    Signed-off-by: Namjae Jeon
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ravishankar N
     

10 Oct, 2012

1 commit


06 Oct, 2012

4 commits

  • 1: Import linux/uaccess.h instead of asm.uaccess.h
    2: Stop any lines going over 80 characters
    3: Stopped setting any variables in if statements
    4: Stopped splitting quoted strings
    5: Removed unneeded parentheses

    Signed-off-by: Cruz Julian Bishop
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cruz Julian Bishop
     
  • Simply remove the spacing between function definitions and
    EXPORT_SYMBOL_GPL calls, which were previously generating warnings.

    Signed-off-by: Cruz Julian Bishop
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cruz Julian Bishop
     
  • Maintain an index of directory inodes by starting cluster, so that
    fat_get_parent() can return the proper cached inode rather than inventing
    one that cannot be traced back to the filesystem root.

    Add a new msdos/vfat binary mount option "nfs" so that FAT filesystems
    that are _not_ exported via NFS are not saddled with maintenance of an
    index they will never use.

    Finally, simplify NFS file handle generation and lookups. An
    ext2-congruent implementation is adequate for FAT needs.

    Signed-off-by: Steven J. Magnani
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Steven J. Magnani
     
  • Use accessor function for msdos_dir_entry 'start'

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     

31 Jul, 2012

1 commit

  • Nearly identical shortname parsing is performed in fat_search_long() and
    __fat_readdir(). Extract this code into a function that may be called by
    both.

    Signed-off-by: Steven J. Magnani
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Steven J. Magnani
     

01 Jun, 2012

1 commit

  • If an application tries to lookup (opendir/readdir/stat) 5000 files on a
    fatfs USB device and the device is unplugged, many message occur, shown
    below. This makes the application slow. So use the new
    fat_msg_ratelimit() decrease the messaging rate.

    #> ./file_lookup_testcase ./files_directory/
    usb 2-1.4: USB disconnect, device number 4
    FAT-fs (sda1): FAT read failed (blocknr 2631)
    FAT-fs (sda1): Directory bread(block 396816) failed
    FAT-fs (sda1): Directory bread(block 396817) failed
    FAT-fs (sda1): Directory bread(block 396818) failed
    FAT-fs (sda1): Directory bread(block 396819) failed
    FAT-fs (sda1): Directory bread(block 396820) failed
    FAT-fs (sda1): Directory bread(block 396821) failed
    FAT-fs (sda1): Directory bread(block 396822) failed
    FAT-fs (sda1): Directory bread(block 396823) failed
    FAT-fs (sda1): Directory bread(block 406824) failed
    FAT-fs (sda1): Directory bread(block 406825) failed
    FAT-fs (sda1): Directory bread(block 406826) failed
    FAT-fs (sda1): Directory bread(block 406827) failed
    FAT-fs (sda1): Directory bread(block 406828) failed
    FAT-fs (sda1): Directory bread(block 406829) failed
    FAT-fs (sda1): Directory bread(block 406830) failed
    FAT-fs (sda1): Directory bread(block 406831) failed
    FAT-fs (sda1): Directory bread(block 417696) failed
    FAT-fs (sda1): Directory bread(block 417697) failed
    FAT-fs (sda1): Directory bread(block 417698) failed
    FAT-fs (sda1): Directory bread(block 417699) failed
    FAT-fs (sda1): Directory bread(block 417700) failed
    FAT-fs (sda1): Directory bread(block 417701) failed
    FAT-fs (sda1): Directory bread(block 417702) failed
    FAT-fs (sda1): Directory bread(block 417703) failed
    FAT-fs (sda1): FAT read failed (blocknr 2631)
    FAT-fs (sda1): Directory bread(block 396816) failed
    FAT-fs (sda1): Directory bread(block 396817) failed
    FAT-fs (sda1): Directory bread(block 396818) failed
    FAT-fs (sda1): Directory bread(block 396819) failed
    FAT-fs (sda1): Directory bread(block 396820) failed
    FAT-fs (sda1): Directory bread(block 396821) failed

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     

01 Nov, 2011

1 commit


17 Aug, 2011

1 commit

  • This fixes a compile warning (unititialized variable) in
    the fat filesystem code.

    Signed-off-by: Jonas Aberg
    Signed-off-by: Lee Jones
    Signed-off-by: Linus Walleij
    Signed-off-by: OGAWA Hirofumi

    Jonas Aberg
     

12 Apr, 2011

1 commit


17 May, 2010

1 commit

  • FAT does not require the BKL in its ioctl function, which is already serialized
    through a mutex. Since we're already touching the ioctl code, also fix the
    missing handling of FAT_IOCTL_GET_ATTRIBUTES in the compat code.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: OGAWA Hirofumi

    Arnd Bergmann
     

16 Mar, 2010

1 commit


13 Jul, 2009

1 commit

  • * Remove smp_lock.h from files which don't need it (including some headers!)
    * Add smp_lock.h to files which do need it
    * Make smp_lock.h include conditional in hardirq.h
    It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

    This will make hardirq.h inclusion cheaper for every PREEMPT=n config
    (which includes allmodconfig/allyesconfig, BTW)

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

    Alexey Dobriyan
     

17 Jun, 2009

2 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (143 commits)
    USB: xhci depends on PCI.
    USB: xhci: Add Makefile, MAINTAINERS, and Kconfig entries.
    USB: xhci: Respect critical sections.
    USB: xHCI: Fix interrupt moderation.
    USB: xhci: Remove packed attribute from structures.
    usb; xhci: Fix TRB offset calculations.
    USB: xhci: replace if-elseif-else with switch-case
    USB: xhci: Make xhci-mem.c include linux/dmapool.h
    USB: xhci: drop spinlock in xhci_urb_enqueue() error path.
    USB: Change names of SuperSpeed ep companion descriptor structs.
    USB: xhci: Avoid compiler reordering in Link TRB giveback.
    USB: xhci: Clean up xhci_irq() function.
    USB: xhci: Avoid global namespace pollution.
    USB: xhci: Fix Link TRB handoff bit twiddling.
    USB: xhci: Fix register write order.
    USB: xhci: fix some compiler warnings in xhci.h
    USB: xhci: fix lots of compiler warnings.
    USB: xhci: use xhci_handle_event instead of handle_event
    USB: xhci: URB cancellation support.
    USB: xhci: Scatter gather list support for bulk transfers.
    ...

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6:
    fat: split fat_generic_ioctl
    FAT: add 'errors' mount option

    Linus Torvalds
     

16 Jun, 2009

1 commit

  • This patch (as1239) updates the kernel's treatment of Unicode. The
    character-set conversion routines are well behind the current state of
    the Unicode specification: They don't recognize the existence of code
    points beyond plane 0 or of surrogate pairs in the UTF-16 encoding.

    The old wchar_t 16-bit type is retained because it's still used in
    lots of places. This shouldn't cause any new problems; if a
    conversion now results in an invalid 16-bit code then before it must
    have yielded an undefined code.

    Difficult-to-read names like "utf_mbstowcs" are replaced with more
    transparent names like "utf8s_to_utf16s" and the ordering of the
    parameters is rationalized (buffer lengths come immediate after the
    pointers they refer to, and the inputs precede the outputs).
    Fortunately the low-level conversion routines are used in only a few
    places; the interfaces to the higher-level uni2char and char2uni
    methods have been left unchanged.

    Signed-off-by: Alan Stern
    Acked-by: Clemens Ladisch
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern