1. 08 6月, 2018 1 次提交
  2. 07 6月, 2018 9 次提交
    • A
      media: omap2: fix compile-testing with FB_OMAP2=m · 48a8bbc7
      Arnd Bergmann 提交于
      Compile-testing with FB_OMAP2=m results in a link error:
      
      drivers/media/platform/omap/omap_vout.o: In function `vidioc_streamoff':
      omap_vout.c:(.text+0x1028): undefined reference to `omap_dispc_unregister_isr'
      drivers/media/platform/omap/omap_vout.o: In function `omap_vout_release':
      omap_vout.c:(.text+0x1330): undefined reference to `omap_dispc_unregister_isr'
      drivers/media/platform/omap/omap_vout.o: In function `vidioc_streamon':
      omap_vout.c:(.text+0x2dd4): undefined reference to `omap_dispc_register_isr'
      drivers/media/platform/omap/omap_vout.o: In function `omap_vout_remove':
      
      In order to enable compile-testing but still keep the correct dependency,
      this changes the Kconfig logic so we only allow CONFIG_COMPILE_TEST
      building when FB_OMAP is completely disabled, or have use the old
      dependency on FB_OMAP to ensure VIDEO_OMAP2_VOUT is also a loadable
      module when FB_OMAP2 is.
      
      Fixes: d8555fd2 ("media: omap2: allow building it with COMPILE_TEST && DRM_OMAP")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      48a8bbc7
    • K
      treewide: Use struct_size() for devm_kmalloc() and friends · 0ed2dd03
      Kees Cook 提交于
      Replaces open-coded struct size calculations with struct_size() for
      devm_*, f2fs_*, and sock_* allocations. Automatically generated (and
      manually adjusted) from the following Coccinelle script:
      
      // Direct reference to struct field.
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
      + alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
      + alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // Same pattern, but can't trivially locate the trailing element name,
      // or variable name.
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      expression SOMETHING, COUNT, ELEMENT;
      @@
      
      - alloc(HANDLE, sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
      + alloc(HANDLE, CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      0ed2dd03
    • K
      treewide: Use struct_size() for vmalloc()-family · b4b06db1
      Kees Cook 提交于
      This only finds one hit in the entire tree, but here's the Coccinelle:
      
      // Directly refer to structure's field
      @@
      identifier alloc =~ "vmalloc|vzalloc";
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT))
      + alloc(struct_size(VAR, ELEMENT, COUNT))
      
      // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
      @@
      identifier alloc =~ "vmalloc|vzalloc";
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]))
      + alloc(struct_size(VAR, ELEMENT, COUNT))
      
      // Same pattern, but can't trivially locate the trailing element name,
      // or variable name.
      @@
      identifier alloc =~ "vmalloc|vzalloc";
      expression SOMETHING, COUNT, ELEMENT;
      @@
      
      - alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT))
      + alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT))
      Signed-off-by: NKees Cook <keescook@chromium.org>
      b4b06db1
    • K
      treewide: Use struct_size() for kmalloc()-family · acafe7e3
      Kees Cook 提交于
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          void *entry[];
      };
      
      instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This patch makes the changes for kmalloc()-family (and kvmalloc()-family)
      uses. It was done via automatic conversion with manual review for the
      "CHECKME" non-standard cases noted below, using the following Coccinelle
      script:
      
      // pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
      //                      sizeof *pkey_cache->table, GFP_KERNEL);
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
      + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
      + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // Same pattern, but can't trivially locate the trailing element name,
      // or variable name.
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      expression SOMETHING, COUNT, ELEMENT;
      @@
      
      - alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
      + alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      acafe7e3
    • X
      net: hns3: Optimize PF CMDQ interrupt switching process · 8e52a602
      Xi Wang 提交于
      When the PF frequently switches the CMDQ interrupt, if the CMDQ_SRC is
      not cleared before the hardware interrupt is generated, the new interrupt
      will not be reported.
      
      This patch optimizes this problem by clearing CMDQ_SRC and RESET_STS
      before enabling interrupt and syncing pending IRQ handlers after disabling
      interrupt.
      
      Fixes: 466b0c00 ("net: hns3: Add support for misc interrupt")
      Signed-off-by: NXi Wang <wangxi11@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8e52a602
    • X
      net: hns3: Fix for VF mailbox receiving unknown message · 6444e2a5
      Xi Wang 提交于
      Before the firmware updates the crq's tail pointer, if the VF driver
      reads the data in the crq, the data may be incomplete at this time,
      which will lead to the driver read an unknown message.
      
      This patch fixes it by checking if crq is empty before reading the
      message.
      
      Fixes: b11a0bb2 ("net: hns3: Add mailbox support to VF driver")
      Signed-off-by: NXi Wang <wangxi11@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6444e2a5
    • X
      net: hns3: Fix for VF mailbox cannot receiving PF response · 1819e409
      Xi Wang 提交于
      When the VF frequently switches the CMDQ interrupt, if the CMDQ_SRC is not
      cleared, the VF will not receive the new PF response after the interrupt
      is re-enabled, the corresponding log is as follows:
      
      [  317.482222] hns3 0000:00:03.0: VF could not get mbx resp(=0) from PF
      in 500 tries
      [  317.483137] hns3 0000:00:03.0: VF request to get tqp info from PF
      failed -5
      
      This patch fixes this problem by clearing CMDQ_SRC before enabling
      interrupt and syncing pending IRQ handlers after disabling interrupt.
      
      Fixes: e2cb1dec ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
      Signed-off-by: NXi Wang <wangxi11@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1819e409
    • J
      bnx2x: use the right constant · dd612f18
      Julia Lawall 提交于
      Nearby code that also tests port suggests that the P0 constant should be
      used when port is zero.
      
      The semantic match that finds this problem is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression e,e1;
      @@
      
      * e ? e1 : e1
      // </smpl>
      
      Fixes: 6c3218c6 ("bnx2x: Adjust ETS to 578xx")
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dd612f18
    • A
      net: dsa: b53: Fix for brcm tag issue in Cygnus SoC · 5040cc99
      Arun Parameswaran 提交于
      In the Broadcom Cygnus SoC, the brcm tag needs to be inserted
      in between the mac address and the ether type (should use
      'DSA_PROTO_TAG_BRCM') for the packets sent to the internal
      b53 switch.
      
      Since the Cygnus was added with the BCM58XX device id and the
      BCM58XX uses 'DSA_PROTO_TAG_BRCM_PREPEND', the data path is
      broken, due to the incorrect brcm tag location.
      
      Add a new b53 device id (BCM583XX) for Cygnus family to fix the
      issue. Add the new device id to the BCM58XX family as Cygnus
      is similar to the BCM58XX in most other functionalities.
      
      Fixes: 11606039 ("net: dsa: b53: Support prepended Broadcom tags")
      Signed-off-by: NArun Parameswaran <arun.parameswaran@broadcom.com>
      Acked-by: NScott Branden <scott.branden@broadcom.com>
      Reported-by: NClément Péron <peron.clem@gmail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: NClément Péron <peron.clem@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5040cc99
  3. 06 6月, 2018 9 次提交
  4. 05 6月, 2018 21 次提交