1. 07 3月, 2018 1 次提交
    • A
      scsi: mpt3sas: clarify mmio pointer types · 6f9e09fd
      Arnd Bergmann 提交于
      The newly added code mixes up phys_addr_t/resource_size_t with dma_addr_t
      and void pointers, as seen from these compiler warning:
      
      drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys':
      drivers/scsi/mpt3sas/mpt3sas_base.c:235:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
        base_chain_phys  = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
                           ^
      drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
      drivers/scsi/mpt3sas/mpt3sas_base.c:427:20: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
          sgel->Address = (dma_addr_t)dst_addr_phys;
                          ^
      drivers/scsi/mpt3sas/mpt3sas_base.c:438:7: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
             (dma_addr_t)buff_ptr_phys;
             ^
      drivers/scsi/mpt3sas/mpt3sas_base.c:444:10: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
                (dma_addr_t)buff_ptr_phys;
      
      Both dma_addr_t and phys_addr_t may be wider than a pointer, so we must
      avoid the conversion to pointer types. This also helps readability.
      
      A second problem is treating MMIO addresses from a 'struct resource'
      as addresses that can be used for DMA on that device. In almost all
      cases, those are the same, but on some of the more obscure architectures,
      PCI memory address 0 is mapped into the CPU address space at a nonzero
      offset. I don't have a good fix for that, so I'm adding a comment here,
      plus a WARN_ON() that triggers whenever the phys_addr_t number is
      outside of the low 32-bit address space and causes a straight overflow
      when assigned to the 32-bit sgel->Address.
      
      Fixes: 182ac784 ("scsi: mpt3sas: Introduce Base function for cloning.")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NSreekanth Reddy <Sreekanth.Reddy@broadcom.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      6f9e09fd
  2. 28 2月, 2018 6 次提交
  3. 22 2月, 2018 1 次提交
  4. 31 1月, 2018 1 次提交
  5. 17 1月, 2018 1 次提交
  6. 11 1月, 2018 7 次提交
  7. 05 12月, 2017 1 次提交
  8. 07 11月, 2017 1 次提交
    • A
      scsi: mpt3sas: fix dma_addr_t casts · d8335ae2
      Arnd Bergmann 提交于
      The newly added base_make_prp_nvme function triggers a build warning on
      some 32-bit configurations:
      
      drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'base_make_prp_nvme':
      drivers/scsi/mpt3sas/mpt3sas_base.c:1664:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
        msg_phys = (dma_addr_t)mpt3sas_base_get_pcie_sgl_dma(ioc, smid);
      
      After taking a closer look, I found that the problem is that the new
      code mixes up pointers and dma_addr_t values unnecessarily.
      
      This changes it to use the correct types consistently, which lets us get
      rid of a lot of type casts in the process. I'm also renaming some
      variables to avoid confusion between physical and dma address spaces
      that are often distinct.
      
      Fixes: 016d5c35 ("scsi: mpt3sas: SGL to PRP Translation for I/Os to NVMe devices")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NSathya Prakash Veerichetty <sathya.prakash@broadcom.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      d8335ae2
  9. 04 11月, 2017 4 次提交
  10. 31 10月, 2017 1 次提交
    • K
      treewide: Fix function prototypes for module_param_call() · e4dca7b7
      Kees Cook 提交于
      Several function prototypes for the set/get functions defined by
      module_param_call() have a slightly wrong argument types. This fixes
      those in an effort to clean up the calls when running under type-enforced
      compiler instrumentation for CFI. This is the result of running the
      following semantic patch:
      
      @match_module_param_call_function@
      declarer name module_param_call;
      identifier _name, _set_func, _get_func;
      expression _arg, _mode;
      @@
      
       module_param_call(_name, _set_func, _get_func, _arg, _mode);
      
      @fix_set_prototype
       depends on match_module_param_call_function@
      identifier match_module_param_call_function._set_func;
      identifier _val, _param;
      type _val_type, _param_type;
      @@
      
       int _set_func(
      -_val_type _val
      +const char * _val
       ,
      -_param_type _param
      +const struct kernel_param * _param
       ) { ... }
      
      @fix_get_prototype
       depends on match_module_param_call_function@
      identifier match_module_param_call_function._get_func;
      identifier _val, _param;
      type _val_type, _param_type;
      @@
      
       int _get_func(
      -_val_type _val
      +char * _val
       ,
      -_param_type _param
      +const struct kernel_param * _param
       ) { ... }
      
      Two additional by-hand changes are included for places where the above
      Coccinelle script didn't notice them:
      
      	drivers/platform/x86/thinkpad_acpi.c
      	fs/lockd/svc.c
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NJessica Yu <jeyu@kernel.org>
      e4dca7b7
  11. 12 10月, 2017 2 次提交
  12. 25 8月, 2017 1 次提交
  13. 11 8月, 2017 1 次提交
  14. 08 8月, 2017 1 次提交
  15. 25 4月, 2017 1 次提交
  16. 24 2月, 2017 1 次提交
  17. 01 2月, 2017 2 次提交
  18. 09 11月, 2016 4 次提交
  19. 13 8月, 2016 1 次提交
    • G
      mpt3sas: Fix resume on WarpDrive flash cards · ce7c6c9e
      Greg Edwards 提交于
      mpt3sas crashes on resume after suspend with WarpDrive flash cards.  The
      reply_post_host_index array is not set back up after the resume, and we
      deference a stale pointer in _base_interrupt().
      
      [   47.309711] BUG: unable to handle kernel paging request at ffffc90001f8006c
      [   47.318289] IP: [<ffffffffc00863ef>] _base_interrupt+0x49f/0xa30 [mpt3sas]
      [   47.326749] PGD 41ccaa067 PUD 41ccab067 PMD 3466c067 PTE 0
      [   47.333848] Oops: 0002 [#1] SMP
      ...
      [   47.452708] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.7.0 #6
      [   47.460506] Hardware name: Dell Inc. OptiPlex 990/06D7TR, BIOS A18 09/24/2013
      [   47.469629] task: ffffffff81c0d500 ti: ffffffff81c00000 task.ti: ffffffff81c00000
      [   47.479112] RIP: 0010:[<ffffffffc00863ef>]  [<ffffffffc00863ef>] _base_interrupt+0x49f/0xa30 [mpt3sas]
      [   47.490466] RSP: 0018:ffff88041d203e30  EFLAGS: 00010002
      [   47.497801] RAX: 0000000000000001 RBX: ffff880033f4c000 RCX: 0000000000000001
      [   47.506973] RDX: ffffc90001f8006c RSI: 0000000000000082 RDI: 0000000000000082
      [   47.516141] RBP: ffff88041d203eb0 R08: ffff8804118e2820 R09: 0000000000000001
      [   47.525300] R10: 0000000000000001 R11: 00000000100c0000 R12: 0000000000000000
      [   47.534457] R13: ffff880412c487e0 R14: ffff88041a8987d8 R15: 0000000000000001
      [   47.543632] FS:  0000000000000000(0000) GS:ffff88041d200000(0000) knlGS:0000000000000000
      [   47.553796] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   47.561632] CR2: ffffc90001f8006c CR3: 0000000001c06000 CR4: 00000000000406f0
      [   47.570883] Stack:
      [   47.575015]  000000001d211228 ffff88041d2100c0 ffff8800c47d8130 0000000000000100
      [   47.584625]  ffff8804100c0000 100c000000000000 ffff88041a8992a0 ffff88041a8987f8
      [   47.594230]  ffff88041d203e00 ffffffff81111e55 000000000000038c ffff880414ad4280
      [   47.603862] Call Trace:
      [   47.608474]  <IRQ>
      [   47.610413]  [<ffffffff81111e55>] ? call_timer_fn+0x35/0x120
      [   47.620539]  [<ffffffff81100a1f>] handle_irq_event_percpu+0x7f/0x1c0
      [   47.629061]  [<ffffffff81100b8c>] handle_irq_event+0x2c/0x50
      [   47.636859]  [<ffffffff81103fff>] handle_edge_irq+0x6f/0x130
      [   47.644654]  [<ffffffff8102fbf3>] handle_irq+0x73/0x120
      [   47.652011]  [<ffffffff810c6ada>] ? atomic_notifier_call_chain+0x1a/0x20
      [   47.660854]  [<ffffffff817e374b>] do_IRQ+0x4b/0xd0
      [   47.667777]  [<ffffffff817e160c>] common_interrupt+0x8c/0x8c
      [   47.675635]  <EOI>
      
      Move the reply_post_host_index array setup into
      mpt3sas_base_map_resources(), which is also in the resume path.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NGreg Edwards <gedwards@fireweed.org>
      Acked-by: NChaitra P B <chaitra.basappa@broadcom.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      ce7c6c9e
  20. 09 8月, 2016 2 次提交