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
     

01 Aug, 2019

1 commit

  • The UDF bitmap allocation code assumes that a recorded
    Unallocated Space Bitmap is compliant with ECMA-167 4/13,
    which requires that pad bytes between the end of the bitmap
    and the end of a logical block are all zero.

    When a recorded bitmap does not comply with this requirement,
    for example one padded with FF to the block boundary instead
    of 00, the allocator may "allocate" blocks that are outside
    the UDF partition extent. This can result in UDF volume descriptors
    being overwritten by file data or by partition-level descriptors,
    and in extreme cases, even in scribbling on a subsequent disk partition.

    Add a check that the block selected by the allocator actually
    resides within the UDF partition extent.

    Signed-off-by: Steven J. Magnani

    Link: https://lore.kernel.org/r/1564341552-129750-1-git-send-email-steve@digidescorp.com
    Signed-off-by: Jan Kara

    Steve Magnani
     

07 Sep, 2018

1 commit

  • We don't support Free Space Table and Free Space Bitmap as specified by
    UDF standard for writing as we don't support erasing blocks before
    overwriting them. Just drop the handling of these structures as
    partition descriptor checking code already makes sure such filesystems
    can be mounted only read-only.

    Signed-off-by: Jan Kara

    Jan Kara
     

03 Sep, 2018

1 commit

  • Variables group_start and nr_groups are being assigned but are never used
    hence they are redundant and can be removed.

    Cleans up clang warning:
    variable 'group_start' set but not used [-Wunused-but-set-variable]
    variable 'nr_groups' set but not used [-Wunused-but-set-variable]

    Signed-off-by: Colin Ian King
    Signed-off-by: Jan Kara

    Colin Ian King
     

20 Jun, 2018

1 commit


17 Oct, 2017

2 commits

  • Fix problems noted in compilion with -Wformat=2 -Wformat-signedness.
    In particular, a mismatch between the signedness of a value and the
    signedness of its format specifier can result in unsigned values being
    printed as negative numbers, e.g.:

    Partition (0 type 1511) starts at physical 460, block length -1779968542

    ...which occurs when mounting a large (> 1 TiB) UDF partition.

    Changes since V1:
    * Fixed additional issues noted in udf_bitmap_free_blocks(),
    udf_get_fileident(), udf_show_options()

    Signed-off-by: Steven J. Magnani
    Signed-off-by: Jan Kara

    Steve Magnani
     
  • Large (> 1 TiB) UDF filesystems appear subject to several problems when
    mounted on 64-bit systems:

    * readdir() can fail on a directory containing File Identifiers residing
    above 0x7FFFFFFF. This manifests as a 'ls' command failing with EIO.

    * FIBMAP on a file block located above 0x7FFFFFFF can return a negative
    value. The low 32 bits are correct, but applications that don't mask the
    high 32 bits of the result can perform incorrectly.

    Per suggestion by Jan Kara, introduce a udf_pblk_t type for representation
    of UDF block addresses. Ultimately, all driver functions that manipulate
    UDF block addresses should use this type; for now, deployment is limited
    to functions with actual or potential sign extension issues.

    Changes to udf_readdir() and udf_block_map() address the issues noted
    above; other changes address potential similar issues uncovered during
    audit of the driver code.

    Signed-off-by: Steven J. Magnani
    Signed-off-by: Jan Kara

    Steve Magnani
     

24 Dec, 2015

1 commit


16 Mar, 2015

1 commit

  • Fix the following warnings:

    fs/udf/balloc.c:768:15: warning: conversion to 'sector_t' from 'int'
    may change the sign of the result [-Wsign-conversion]
    allocated = udf_bitmap_prealloc_blocks(sb,
    ^
    fs/udf/balloc.c:773:15: warning: conversion to 'sector_t' from 'int'
    may change the sign of the result [-Wsign-conversion]
    allocated = udf_table_prealloc_blocks(sb,
    ^
    fs/udf/balloc.c:778:15: warning: conversion to 'sector_t' from 'int'
    may change the sign of the result [-Wsign-conversion]
    allocated = udf_bitmap_prealloc_blocks(sb,
    ^
    fs/udf/balloc.c:783:15: warning: conversion to 'sector_t' from 'int'
    may change the sign of the result [-Wsign-conversion]
    allocated = udf_table_prealloc_blocks(sb,
    ^
    fs/udf/balloc.c:791:26: warning: conversion to 'loff_t' from 'sector_t'
    may change the sign of the result [-Wsign-conversion]
    inode_add_bytes(inode, allocated << sb->s_blocksize_bits);
    ^
    fs/udf/balloc.c:792:2: warning: conversion to 'int' from 'sector_t'
    may alter its value [-Wconversion]
    return allocated;

    Suggested-by: Jan Kara
    Signed-off-by: Fabian Frederick
    Signed-off-by: Jan Kara

    Fabian Frederick
     

14 Mar, 2015

3 commits


01 Mar, 2012

1 commit

  • Commit 36350462 removed unused quota support from UDF. As an unfortunate
    sideeffect it also removed updates of i_blocks so all files had i_block == 0.
    Fix the problem by returning updates of file space back to UDF allocation and
    freeing functions.

    Signed-off-by: Jan Kara

    Jan Kara
     

01 Nov, 2011

1 commit


24 Mar, 2011

1 commit

  • As a preparation for removing ext2 non-atomic bit operations from
    asm/bitops.h. This converts ext2 non-atomic bit operations to
    little-endian bit operations.

    Signed-off-by: Akinobu Mita
    Acked-by: Jan Kara
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

23 Feb, 2011

1 commit

  • Fix compiler warning

    fs/udf/balloc.c: In function 'udf_bitmap_new_block':
    fs/udf/balloc.c:273: warning: passing argument 1 of '_find_next_bit_le' from incompatible pointer type
    fs/udf/balloc.c:285: warning: passing argument 1 of '_find_next_bit_le' from incompatible pointer type
    fs/udf/balloc.c:311: warning: passing argument 1 of '_find_next_bit_le' from incompatible pointer type
    fs/udf/balloc.c:325: warning: passing argument 1 of '_find_next_bit_le' from incompatible pointer type

    The main fix is to add a cast in ext2_find_next_bit().

    As all other usage locations of udf_find_next_one_bit()
    directly use bh->b_data (which is a char *), the useless
    (char *) cast in line 311 can be removed, too.

    Signed-off-by: Dirk Behme
    Signed-off-by: George G. Davis
    Signed-off-by: Jan Kara

    Dirk Behme
     

07 Jan, 2011

1 commit


24 May, 2010

1 commit

  • Quota on UDF is non-functional at least since 2.6.16 (I'm too lazy to
    do more archeology) because it does not provide .quota_write and .quota_read
    functions and thus quotaon(8) just returns EINVAL. Since nobody complained
    for all those years and quota support is not even in UDF standard just nuke
    it.

    Signed-off-by: Jan Kara

    Jan Kara
     

08 Apr, 2010

1 commit

  • bloc->logicalBlockNum is unsigned so it's never less than zero.

    When I saw that, it made me worry that "bloc->logicalBlockNum + count"
    could overflow. That's why I changed the check for less than zero
    to an overflow check. (The test works because "count" is also
    unsigned.)

    Signed-off-by: Dan Carpenter
    Signed-off-by: Jan Kara

    Dan Carpenter
     

10 Mar, 2010

1 commit


06 Mar, 2010

1 commit

  • * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: (33 commits)
    quota: stop using QUOTA_OK / NO_QUOTA
    dquot: cleanup dquot initialize routine
    dquot: move dquot initialization responsibility into the filesystem
    dquot: cleanup dquot drop routine
    dquot: move dquot drop responsibility into the filesystem
    dquot: cleanup dquot transfer routine
    dquot: move dquot transfer responsibility into the filesystem
    dquot: cleanup inode allocation / freeing routines
    dquot: cleanup space allocation / freeing routines
    ext3: add writepage sanity checks
    ext3: Truncate allocated blocks if direct IO write fails to update i_size
    quota: Properly invalidate caches even for filesystems with blocksize < pagesize
    quota: generalize quota transfer interface
    quota: sb_quota state flags cleanup
    jbd: Delay discarding buffers in journal_unmap_buffer
    ext3: quota_write cross block boundary behaviour
    quota: drop permission checks from xfs_fs_set_xstate/xfs_fs_set_xquota
    quota: split out compat_sys_quotactl support from quota.c
    quota: split out netlink notification support from quota.c
    quota: remove invalid optimization from quota_sync_all
    ...

    Fixed trivial conflicts in fs/namei.c and fs/ufs/inode.c

    Linus Torvalds
     

05 Mar, 2010

1 commit

  • Get rid of the alloc_space, free_space, reserve_space, claim_space and
    release_rsv dquot operations - they are always called from the filesystem
    and if a filesystem really needs their own (which none currently does)
    it can just call into it's own routine directly.

    Move shared logic into the common __dquot_alloc_space,
    dquot_claim_space_nodirty and __dquot_free_space low-level methods,
    and rationalize the wrappers around it to move as much as possible
    code into the common block for CONFIG_QUOTA vs not. Also rename
    all these helpers to be named dquot_* instead of vfs_dq_*.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jan Kara

    Christoph Hellwig
     

04 Mar, 2010

1 commit


15 Dec, 2009

1 commit


24 Jun, 2009

1 commit


02 Apr, 2009

4 commits

  • We update information in logical volume integrity descriptor after each
    allocation (as LVID contains free space, number of directories and files on
    disk etc.). If the filesystem is on some phase change media, this leads to its
    quick degradation as such media is able to handle only 10000 overwrites or so.
    We solve the problem by writing new information into LVID only on umount,
    remount-ro and sync. This solves the problem at the price of longer media
    inconsistency (previously media became consistent after pdflush flushed dirty
    LVID buffer) but that should be acceptable.

    Report by and patch written in cooperation with
    Rich Coe .

    Signed-off-by: Jan Kara

    Jan Kara
     
  • Fix sparse warnings:

    fs/udf/balloc.c:843:3: warning: returning void-valued expression
    fs/udf/balloc.c:847:3: warning: returning void-valued expression
    fs/udf/balloc.c:851:3: warning: returning void-valued expression
    fs/udf/balloc.c:855:3: warning: returning void-valued expression

    Reported-by: Hannes Eder
    Signed-off-by: Jan Kara

    Jan Kara
     
  • Signed-off-by: Pekka Enberg
    Signed-off-by: Jan Kara

    Pekka Enberg
     
  • Signed-off-by: Pekka Enberg
    Signed-off-by: Jan Kara

    Pekka Enberg
     

26 Mar, 2009

1 commit


17 Apr, 2008

1 commit


14 Feb, 2008

1 commit

  • In commit 742ba02a51c8d0bf5446b154531179760c1ed0a2 (udf: create common
    function for changing free space counter) by accident I reversed safety
    condition which lead to null pointer dereference in case of media error and
    wrong counting of free space in normal situation

    Signed-off-by: Marcin Slusarz
    Cc: Jan Kara
    Acked-by: Cyrill Gorcunov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     

09 Feb, 2008

7 commits

  • cache UDF_I(struct inode *) return values when there are
    at least 2 uses in one function

    Signed-off-by: Marcin Slusarz
    Acked-by: Jan Kara
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     
  • Signed-off-by: Marcin Slusarz
    Acked-by: Jan Kara
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     
  • Signed-off-by: Marcin Slusarz
    Acked-by: Jan Kara
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     
  • Signed-off-by: Marcin Slusarz
    Acked-by: Jan Kara
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     
  • fix coding style errors found by checkpatch:
    - assignments in if conditions
    - braces {} around single statement blocks
    - no spaces after commas
    - printks without KERN_*
    - lines longer than 80 characters
    - spaces between "type *" and variable name

    before: 192 errors, 561 warnings, 8987 lines checked
    after: 1 errors, 38 warnings, 9468 lines checked

    Signed-off-by: Marcin Slusarz
    Cc: Jan Kara
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     
  • Signed-off-by: Marcin Slusarz
    Cc: Ben Fennema
    Acked-by: Jan Kara
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     
  • remove macros:
    - UDF_SB_PARTMAPS
    - UDF_SB_PARTTYPE
    - UDF_SB_PARTROOT
    - UDF_SB_PARTLEN
    - UDF_SB_PARTVSN
    - UDF_SB_PARTNUM
    - UDF_SB_TYPESPAR
    - UDF_SB_TYPEVIRT
    - UDF_SB_PARTFUNC
    - UDF_SB_PARTFLAGS
    - UDF_SB_VOLIDENT
    - UDF_SB_NUMPARTS
    - UDF_SB_PARTITION
    - UDF_SB_SESSION
    - UDF_SB_ANCHOR
    - UDF_SB_LASTBLOCK
    - UDF_SB_LVIDBH
    - UDF_SB_LVID
    - UDF_SB_UMASK
    - UDF_SB_GID
    - UDF_SB_UID
    - UDF_SB_RECORDTIME
    - UDF_SB_SERIALNUM
    - UDF_SB_UDFREV
    - UDF_SB_FLAGS
    - UDF_SB_VAT
    - UDF_UPDATE_UDFREV
    - UDF_SB_FREE
    and open code them

    convert UDF_SB_LVIDIU macro to udf_sb_lvidiu function

    rename some struct udf_sb_info fields:
    - s_volident to s_volume_ident
    - s_lastblock to s_last_block
    - s_lvidbh to s_lvid_bh
    - s_recordtime to s_record_time
    - s_serialnum to s_serial_number;
    - s_vat to s_vat_inode;

    Signed-off-by: Marcin Slusarz
    Cc: Ben Fennema
    Cc: Jan Kara
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marcin Slusarz
     

17 Oct, 2007

1 commit