1. 23 7月, 2019 1 次提交
  2. 17 7月, 2019 1 次提交
  3. 19 6月, 2019 3 次提交
  4. 05 6月, 2019 1 次提交
  5. 16 4月, 2019 1 次提交
  6. 04 4月, 2019 3 次提交
  7. 27 2月, 2019 3 次提交
    • A
      scsi: ufs: Allow reading descriptor via raw upiu · 4bbbe242
      Avri Altman 提交于
      Allow to read descriptors via raw upiu. This in fact was forbidden just as
      a precaution, as ufs-bsg actually enforces which functionality is
      supported.
      Signed-off-by: NAvri Altman <avri.altman@wdc.com>
      Reviewed-by: NEvan Green <evgreen@chromium.org>
      Reviewed-by: NBean Huo <beanhuo@micron.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      4bbbe242
    • M
      scsi: ufs: Remove unused device quirks · e9cb9655
      Marc Gonzalez 提交于
      The UFSHC driver defines a few quirks that are not used anywhere:
      
      UFS_DEVICE_QUIRK_BROKEN_LCC
      UFS_DEVICE_NO_VCCQ
      UFS_DEVICE_QUIRK_NO_LINK_OFF
      UFS_DEVICE_NO_FASTAUTO
      
      Let's remove them.
      Acked-by: NAvri Altman <avri.altman@wdc.com>
      Acked-by: NAlim Akhtar <alim.akhtar@samsung.com>
      Reviewed-by: NEvan Green <evgreen@chromium.org>
      Signed-off-by: NMarc Gonzalez <marc.w.gonzalez@free.fr>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      e9cb9655
    • M
      Revert "scsi: ufs: disable vccq if it's not needed by UFS device" · 73067981
      Marc Gonzalez 提交于
      This reverts commit 60f01870.
      
      There was one conflict in drivers/scsi/ufs/ufshcd.c
      
      <<<<<<< HEAD
      	/* Init check for device descriptor sizes */
      	ufshcd_init_desc_sizes(hba);
      
      	ret = ufs_get_device_desc(hba, &card);
      	if (ret) {
      		dev_err(hba->dev, "%s: Failed getting device info. err = %d\n",
      			__func__, ret);
      		goto out;
      	}
      
      	ufs_fixup_device_setup(hba, &card);
      	ufshcd_tune_unipro_params(hba);
      
      	ret = ufshcd_set_vccq_rail_unused(hba,
      		(hba->dev_quirks & UFS_DEVICE_NO_VCCQ) ? true : false);
      	if (ret)
      		goto out;
      
      =======
      	ufs_advertise_fixup_device(hba);
      >>>>>>> parent of 60f01870... scsi: ufs: disable vccq if it's not needed by UFS device
      
      Resolution: keep HEAD, and delete the ufshcd_set_vccq_rail_unused() call
      and corresponding error-handling code.
      
      Clean up loose ends in a follow-up patch.
      
      60f01870 introduced a small power optimization: ignore the vccq load
      specified in the UFSHC DT node when said host controller is connected to
      specific Flash chips (currently, Samsung and Hynix).
      
      Unfortunately, this optimization breaks UFS on systems where vccq powers
      not only the Flash chip, but the host controller as well, such as APQ8098
      MEDIABOX or MTP8998:
      
      [    3.929877] ufshcd-qcom 1da4000.ufshc: ufshcd_query_attr: opcode 0x04 for idn 13 failed, index 0, err = -11
      [    5.433815] ufshcd-qcom 1da4000.ufshc: ufshcd_query_attr: opcode 0x04 for idn 13 failed, index 0, err = -11
      [    6.937771] ufshcd-qcom 1da4000.ufshc: ufshcd_query_attr: opcode 0x04 for idn 13 failed, index 0, err = -11
      [    6.937866] ufshcd-qcom 1da4000.ufshc: ufshcd_query_attr_retry: query attribute, idn 13, failed with error -11 after 3 retires
      [    6.946412] ufshcd-qcom 1da4000.ufshc: ufshcd_disable_auto_bkops: failed to enable exception event -11
      [    6.957972] ufshcd-qcom 1da4000.ufshc: dme-peer-get: attr-id 0x1587 failed 3 retries
      [    6.967181] ufshcd-qcom 1da4000.ufshc: dme-peer-get: attr-id 0x1586 failed 3 retries
      [    6.975025] ufshcd-qcom 1da4000.ufshc: ufshcd_get_max_pwr_mode: invalid max pwm tx gear read = 0
      [    6.982755] ufshcd-qcom 1da4000.ufshc: ufshcd_probe_hba: Failed getting max supported power mode
      [    8.505770] ufshcd-qcom 1da4000.ufshc: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
      [   10.009807] ufshcd-qcom 1da4000.ufshc: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
      [   11.513766] ufshcd-qcom 1da4000.ufshc: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
      [   11.513861] ufshcd-qcom 1da4000.ufshc: ufshcd_query_flag_retry: query attribute, opcode 5, idn 3, failed with error -11 after 3 retires
      [   13.049807] ufshcd-qcom 1da4000.ufshc: __ufshcd_query_descriptor: opcode 0x01 for idn 8 failed, index 0, err = -11
      [   14.553768] ufshcd-qcom 1da4000.ufshc: __ufshcd_query_descriptor: opcode 0x01 for idn 8 failed, index 0, err = -11
      [   16.057767] ufshcd-qcom 1da4000.ufshc: __ufshcd_query_descriptor: opcode 0x01 for idn 8 failed, index 0, err = -11
      [   16.057872] ufshcd-qcom 1da4000.ufshc: ufshcd_read_desc_param: Failed reading descriptor. desc_id 8, desc_index 0, param_offset 0, ret -11
      [   16.067109] ufshcd-qcom 1da4000.ufshc: ufshcd_init_icc_levels: Failed reading power descriptor.len = 98 ret = -11
      [   37.073787] ufshcd-qcom 1da4000.ufshc: link startup failed 1
      
      In my opinion, the rationale for the original patch is questionable.  If
      neither the UFSHC, nor the Flash chip, require any load from vccq, then
      that power rail should simply not be specified at all in the DT.
      
      Working around that fact in the driver is detrimental, as evidenced by the
      failure to initialize the host controller on MSM8998.
      Acked-by: NAvri Altman <avri.altman@wdc.com>
      Acked-by: NAlim Akhtar <alim.akhtar@samsung.com>
      Signed-off-by: NMarc Gonzalez <marc.w.gonzalez@free.fr>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      73067981
  8. 05 2月, 2019 1 次提交
  9. 23 1月, 2019 1 次提交
    • M
      scsi: ufs: Use explicit access size in ufshcd_dump_regs · d6724756
      Marc Gonzalez 提交于
      memcpy_fromio() doesn't provide any control over access size.  For example,
      on arm64, it is implemented using readb and readq.  This may trigger a
      synchronous external abort:
      
      [    3.729943] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP
      [    3.737000] Modules linked in:
      [    3.744371] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G S                4.20.0-rc4 #16
      [    3.747413] Hardware name: Qualcomm Technologies, Inc. MSM8998 v1 MTP (DT)
      [    3.755295] pstate: 00000005 (nzcv daif -PAN -UAO)
      [    3.761978] pc : __memcpy_fromio+0x68/0x80
      [    3.766718] lr : ufshcd_dump_regs+0x50/0xb0
      [    3.770767] sp : ffff00000807ba00
      [    3.774830] x29: ffff00000807ba00 x28: 00000000fffffffb
      [    3.778344] x27: ffff0000089db068 x26: ffff8000f6e58000
      [    3.783728] x25: 000000000000000e x24: 0000000000000800
      [    3.789023] x23: ffff8000f6e587c8 x22: 0000000000000800
      [    3.794319] x21: ffff000008908368 x20: ffff8000f6e1ab80
      [    3.799615] x19: 000000000000006c x18: ffffffffffffffff
      [    3.804910] x17: 0000000000000000 x16: 0000000000000000
      [    3.810206] x15: ffff000009199648 x14: ffff000089244187
      [    3.815502] x13: ffff000009244195 x12: ffff0000091ab000
      [    3.820797] x11: 0000000005f5e0ff x10: ffff0000091998a0
      [    3.826093] x9 : 0000000000000000 x8 : ffff8000f6e1ac00
      [    3.831389] x7 : 0000000000000000 x6 : 0000000000000068
      [    3.836676] x5 : ffff8000f6e1abe8 x4 : 0000000000000000
      [    3.841971] x3 : ffff00000928c868 x2 : ffff8000f6e1abec
      [    3.847267] x1 : ffff00000928c868 x0 : ffff8000f6e1abe8
      [    3.852567] Process swapper/0 (pid: 1, stack limit = 0x(____ptrval____))
      [    3.857900] Call trace:
      [    3.864473]  __memcpy_fromio+0x68/0x80
      [    3.866683]  ufs_qcom_dump_dbg_regs+0x1c0/0x370
      [    3.870522]  ufshcd_print_host_regs+0x168/0x190
      [    3.874946]  ufshcd_init+0xd4c/0xde0
      [    3.879459]  ufshcd_pltfrm_init+0x3c8/0x550
      [    3.883264]  ufs_qcom_probe+0x24/0x60
      [    3.887188]  platform_drv_probe+0x50/0xa0
      
      Assuming aligned 32-bit registers, let's use readl, after making sure
      that 'offset' and 'len' are indeed multiples of 4.
      
      Fixes: ba80917d ("scsi: ufs: ufshcd_dump_regs to use memcpy_fromio")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMarc Gonzalez <marc.w.gonzalez@free.fr>
      Acked-by: NTomas Winkler <tomas.winkler@intel.com>
      Reviewed-by: NJeffrey Hugo <jhugo@codeaurora.org>
      Reviewed-by: NBjorn Andersson <bjorn.andersson@linaro.org>
      Tested-by: NEvan Green <evgreen@chromium.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      d6724756
  10. 12 1月, 2019 1 次提交
  11. 19 12月, 2018 2 次提交
  12. 08 12月, 2018 1 次提交
  13. 29 11月, 2018 1 次提交
  14. 09 11月, 2018 2 次提交
  15. 08 11月, 2018 1 次提交
  16. 07 11月, 2018 1 次提交
  17. 18 10月, 2018 1 次提交
    • E
      scsi: ufs: Schedule clk gating work on correct queue · f4bb7704
      Evan Green 提交于
      With commit 10e5e375 ("scsi: ufs: Add clock ungating to a separate
      workqueue"), clock gating work was moved to a separate work queue with
      WQ_MEM_RECLAIM set, since clock gating could occur from a memory reclaim
      context. Unfortunately, clk_gating.gate_work was left queued via
      schedule_delayed_work, which is a system workqueue that does not have
      WQ_MEM_RECLAIM set.  Because ufshcd_ungate_work attempts to cancel
      gate_work, the following warning appears:
      
      [   14.174170] workqueue: WQ_MEM_RECLAIM ufs_clk_gating_0:ufshcd_ungate_work is flushing !WQ_MEM_RECLAIM events:ufshcd_gate_work
      [   14.174179] WARNING: CPU: 4 PID: 173 at kernel/workqueue.c:2440 check_flush_dependency+0x110/0x118
      [   14.205725] CPU: 4 PID: 173 Comm: kworker/u16:3 Not tainted 4.14.68 #1
      [   14.212437] Hardware name: Google Cheza (rev1) (DT)
      [   14.217459] Workqueue: ufs_clk_gating_0 ufshcd_ungate_work
      [   14.223107] task: ffffffc0f6a40080 task.stack: ffffff800a490000
      [   14.229195] PC is at check_flush_dependency+0x110/0x118
      [   14.234569] LR is at check_flush_dependency+0x110/0x118
      [   14.239944] pc : [<ffffff80080cad14>] lr : [<ffffff80080cad14>] pstate: 60c001c9
      [   14.333050] Call trace:
      [   14.427767] [<ffffff80080cad14>] check_flush_dependency+0x110/0x118
      [   14.434219] [<ffffff80080cafec>] start_flush_work+0xac/0x1fc
      [   14.440046] [<ffffff80080caeec>] flush_work+0x40/0x94
      [   14.445246] [<ffffff80080cb288>] __cancel_work_timer+0x11c/0x1b8
      [   14.451433] [<ffffff80080cb4b8>] cancel_delayed_work_sync+0x20/0x30
      [   14.457886] [<ffffff80085b9294>] ufshcd_ungate_work+0x24/0xd0
      [   14.463800] [<ffffff80080cfb04>] process_one_work+0x32c/0x690
      [   14.469713] [<ffffff80080d0154>] worker_thread+0x218/0x338
      [   14.475361] [<ffffff80080d527c>] kthread+0x120/0x130
      [   14.480470] [<ffffff8008084814>] ret_from_fork+0x10/0x18
      
      The simple solution is to put the gate_work on the same WQ_MEM_RECLAIM
      work queue as the ungate_work.
      
      Fixes: 10e5e375 ("scsi: ufs: Add clock ungating to a separate workqueue")
      Signed-off-by: NEvan Green <evgreen@chromium.org>
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Reviewed-by: NStephen Boyd <swboyd@chromium.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      f4bb7704
  18. 11 10月, 2018 7 次提交
  19. 21 9月, 2018 1 次提交
  20. 17 9月, 2018 1 次提交
  21. 09 8月, 2018 1 次提交
  22. 27 6月, 2018 1 次提交
  23. 20 6月, 2018 1 次提交
  24. 13 6月, 2018 1 次提交
    • K
      treewide: devm_kzalloc() -> devm_kcalloc() · a86854d0
      Kees Cook 提交于
      The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
      This patch replaces cases of:
      
              devm_kzalloc(handle, a * b, gfp)
      
      with:
              devm_kcalloc(handle, a * b, gfp)
      
      as well as handling cases of:
      
              devm_kzalloc(handle, a * b * c, gfp)
      
      with:
      
              devm_kzalloc(handle, array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              devm_kcalloc(handle, array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              devm_kzalloc(handle, 4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      Some manual whitespace fixes were needed in this patch, as Coccinelle
      really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      expression HANDLE;
      type TYPE;
      expression THING, E;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression HANDLE;
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      expression HANDLE;
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      expression HANDLE;
      identifier SIZE, COUNT;
      @@
      
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression HANDLE;
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression HANDLE;
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      expression HANDLE;
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression HANDLE;
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression HANDLE;
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
      |
        devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2, ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      a86854d0
  25. 29 5月, 2018 1 次提交
  26. 19 5月, 2018 1 次提交