1. 07 Jun, 2021 1 commit
    • Gustavo A. R. Silva's avatar
      media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2() · 13dfead4
      Gustavo A. R. Silva authored
      Rename struct sms_msg_data4 to sms_msg_data5 and increase the size of
      its msg_data array from 4 to 5 elements. Notice that at some point
      the 5th element of msg_data is being accessed in function
      smscore_load_firmware_family2():
      
      1006                 trigger_msg->msg_data[4] = 4; /* Task ID */
      
      Also, there is no need for the object _trigger_msg_ of type struct
      sms_msg_data *, when _msg_ can be used, directly. Notice that msg_data
      in struct sms_msg_data is a one-element array, which causes multiple
      out-of-bounds warnings when accessing beyond its first element
      in function smscore_load_firmware_family2():
      
       992                 struct sms_msg_data *trigger_msg =
       993                         (struct sms_msg_data *) msg;
       994
       995                 pr_debug("sending MSG_SMS_SWDOWNLOAD_TRIGGER_REQ\n");
       996                 SMS_INIT_MSG(&msg->x_msg_header,
       997                                 MSG_SMS_SWDOWNLOAD_TRIGGER_REQ,
       998                                 sizeof(struct sms_msg_hdr) +
       999                                 sizeof(u32) * 5);
      1000
      1001                 trigger_msg->msg_data[0] = firmware->start_address;
      1002                                         /* Entry point */
      1003                 trigger_msg->msg_data[1] = 6; /* Priority */
      1004                 trigger_msg->msg_data[2] = 0x200; /* Stack size */
      1005                 trigger_msg->msg_data[3] = 0; /* Parameter */
      1006                 trigger_msg->msg_data[4] = 4; /* Task ID */
      
      even when enough dynamic memory is allocated for _msg_:
      
       929         /* PAGE_SIZE buffer shall be enough and dma aligned */
       930         msg = kmalloc(PAGE_SIZE, GFP_KERNEL | coredev->gfp_buf_flags);
      
      but as _msg_ is casted to (struct sms_msg_data *):
      
       992                 struct sms_msg_data *trigger_msg =
       993                         (struct sms_msg_data *) msg;
      
      the out-of-bounds warnings are actually valid and should be addressed.
      
      Fix this by declaring object _msg_ of type struct sms_msg_data5 *,
      which contains a 5-elements array, instead of just 4. And use
      _msg_ directly, instead of creating object trigger_msg.
      
      This helps with the ongoing efforts to enable -Warray-bounds by fixing
      the following warnings:
      
        CC [M]  drivers/media/common/siano/smscoreapi.o
      drivers/media/common/siano/smscoreapi.c: In function ‘smscore_load_firmware_family2’:
      drivers/media/common/siano/smscoreapi.c:1003:24: warning: array subscript 1 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
       1003 |   trigger_msg->msg_data[1] = 6; /* Priority */
            |   ~~~~~~~~~~~~~~~~~~~~~^~~
      In file included from drivers/media/common/siano/smscoreapi.c:12:
      drivers/media/common/siano/smscoreapi.h:619:6: note: while referencing ‘msg_data’
        619 |  u32 msg_data[1];
            |      ^~~~~~~~
      drivers/media/common/siano/smscoreapi.c:1004:24: warning: array subscript 2 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
       1004 |   trigger_msg->msg_data[2] = 0x200; /* Stack size */
            |   ~~~~~~~~~~~~~~~~~~~~~^~~
      In file included from drivers/media/common/siano/smscoreapi.c:12:
      drivers/media/common/siano/smscoreapi.h:619:6: note: while referencing ‘msg_data’
        619 |  u32 msg_data[1];
            |      ^~~~~~~~
      drivers/media/common/siano/smscoreapi.c:1005:24: warning: array subscript 3 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
       1005 |   trigger_msg->msg_data[3] = 0; /* Parameter */
            |   ~~~~~~~~~~~~~~~~~~~~~^~~
      In file included from drivers/media/common/siano/smscoreapi.c:12:
      drivers/media/common/siano/smscoreapi.h:619:6: note: while referencing ‘msg_data’
        619 |  u32 msg_data[1];
            |      ^~~~~~~~
      drivers/media/common/siano/smscoreapi.c:1006:24: warning: array subscript 4 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
       1006 |   trigger_msg->msg_data[4] = 4; /* Task ID */
            |   ~~~~~~~~~~~~~~~~~~~~~^~~
      In file included from drivers/media/common/siano/smscoreapi.c:12:
      drivers/media/common/siano/smscoreapi.h:619:6: note: while referencing ‘msg_data’
        619 |  u32 msg_data[1];
            |      ^~~~~~~~
      
      Fixes: 018b0c6f ("[media] siano: make load firmware logic to work with newer firmwares")
      Co-developed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      13dfead4
  2. 16 May, 2021 7 commits
    • Linus Torvalds's avatar
      Linux 5.13-rc2 · d07f6ca9
      Linus Torvalds authored
      d07f6ca9
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.13-rc2' of... · 28183dbf
      Linus Torvalds authored
      Merge tag 'driver-core-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core fixes from Greg KH:
       "Here are two driver fixes for driver core changes that happened in
        5.13-rc1.
      
        The clk driver fix resolves a many-reported issue with booting some
        devices, and the USB typec fix resolves the reported problem of USB
        systems on some embedded boards.
      
        Both of these have been in linux-next this week with no reported
        issues"
      
      * tag 'driver-core-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        clk: Skip clk provider registration when np is NULL
        usb: typec: tcpm: Don't block probing of consumers of "connector" nodes
      28183dbf
    • Linus Torvalds's avatar
      Merge tag 'staging-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 6942d81a
      Linus Torvalds authored
      Pull staging and IIO driver fixes from Greg KH:
       "Here are some small IIO driver fixes and one Staging driver fix for
        5.13-rc2.
      
        Nothing major, just some resolutions for reported problems:
      
         - gcc-11 bogus warning fix for rtl8723bs
      
         - iio driver tiny fixes
      
        All of these have been in linux-next for many days with no reported
        issues"
      
      * tag 'staging-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        iio: tsl2583: Fix division by a zero lux_val
        iio: core: return ENODEV if ioctl is unknown
        iio: core: fix ioctl handlers removal
        iio: gyro: mpu3050: Fix reported temperature value
        iio: hid-sensors: select IIO_TRIGGERED_BUFFER under HID_SENSOR_IIO_TRIGGER
        iio: proximity: pulsedlight: Fix rumtime PM imbalance on error
        iio: light: gp2ap002: Fix rumtime PM imbalance on error
        staging: rtl8723bs: avoid bogus gcc warning
      6942d81a
    • Linus Torvalds's avatar
      Merge tag 'usb-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 4a668429
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small USB fixes for 5.13-rc2. They consist of a number
        of resolutions for reported issues:
      
         - typec fixes for found problems
      
         - xhci fixes and quirk additions
      
         - dwc3 driver fixes
      
         - minor fixes found by Coverity
      
         - cdc-wdm fixes for reported problems
      
        All of these have been in linux-next for a few days with no reported
        issues"
      
      * tag 'usb-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (28 commits)
        usb: core: hub: fix race condition about TRSMRCY of resume
        usb: typec: tcpm: Fix SINK_DISCOVERY current limit for Rp-default
        xhci: Add reset resume quirk for AMD xhci controller.
        usb: xhci: Increase timeout for HC halt
        xhci: Do not use GFP_KERNEL in (potentially) atomic context
        xhci: Fix giving back cancelled URBs even if halted endpoint can't reset
        xhci-pci: Allow host runtime PM as default for Intel Alder Lake xHCI
        usb: musb: Fix an error message
        usb: typec: tcpm: Fix wrong handling for Not_Supported in VDM AMS
        usb: typec: tcpm: Send DISCOVER_IDENTITY from dedicated work
        usb: typec: ucsi: Retrieve all the PDOs instead of just the first 4
        usb: fotg210-hcd: Fix an error message
        docs: usb: function: Modify path name
        usb: dwc3: omap: improve extcon initialization
        usb: typec: ucsi: Put fwnode in any case during ->probe()
        usb: typec: tcpm: Fix wrong handling in GET_SINK_CAP
        usb: dwc2: Remove obsolete MODULE_ constants from platform.c
        usb: dwc3: imx8mp: fix error return code in dwc3_imx8mp_probe()
        usb: dwc3: imx8mp: detect dwc3 core node via compatible string
        usb: dwc3: gadget: Return success always for kick transfer in ep queue
        ...
      4a668429
    • Linus Torvalds's avatar
      Merge tag 'timers-urgent-2021-05-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8ce36481
      Linus Torvalds authored
      Pull timer fixes from Thomas Gleixner:
       "Two fixes for timers:
      
         - Use the ALARM feature check in the alarmtimer core code insted of
           the old method of checking for the set_alarm() callback.
      
           Drivers can have that callback set but the feature bit cleared. If
           such a RTC device is selected then alarms wont work.
      
         - Use a proper define to let the preprocessor check whether Hyper-V
           VDSO clocksource should be active.
      
           The code used a constant in an enum with #ifdef, which evaluates to
           always false and disabled the clocksource for VDSO"
      
      * tag 'timers-urgent-2021-05-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86
        alarmtimer: Check RTC features instead of ops
      8ce36481
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.13b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · f44e58bb
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
      
       - two patches for error path fixes
      
       - a small series for fixing a regression with swiotlb with Xen on Arm
      
      * tag 'for-linus-5.13b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/swiotlb: check if the swiotlb has already been initialized
        arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required
        xen/arm: move xen_swiotlb_detect to arm/swiotlb-xen.h
        xen/unpopulated-alloc: fix error return code in fill_list()
        xen/gntdev: fix gntdev_mmap() error exit path
      f44e58bb
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v5.13_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ccb013c2
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
       "The three SEV commits are not really urgent material. But we figured
        since getting them in now will avoid a huge amount of conflicts
        between future SEV changes touching tip, the kvm and probably other
        trees, sending them to you now would be best.
      
        The idea is that the tip, kvm etc branches for 5.14 will all base
        ontop of -rc2 and thus everything will be peachy. What is more, those
        changes are purely mechanical and defines movement so they should be
        fine to go now (famous last words).
      
        Summary:
      
         - Enable -Wundef for the compressed kernel build stage
      
         - Reorganize SEV code to streamline and simplify future development"
      
      * tag 'x86_urgent_for_v5.13_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/boot/compressed: Enable -Wundef
        x86/msr: Rename MSR_K8_SYSCFG to MSR_AMD64_SYSCFG
        x86/sev: Move GHCB MSR protocol and NAE definitions in a common header
        x86/sev-es: Rename sev-es.{ch} to sev.{ch}
      ccb013c2
  3. 15 May, 2021 27 commits
  4. 14 May, 2021 5 commits