1. 11 7月, 2017 2 次提交
    • G
      mmc: block: Let MMC_IOC_MULTI_CMD return zero again for zero entries · aab2ee03
      Geert Uytterhoeven 提交于
      With gcc 4.1.2:
      
          drivers/mmc/core/block.c: In function ‘mmc_blk_ioctl_cmd_issue’:
          drivers/mmc/core/block.c:630: warning: ‘ioc_err’ may be used uninitialized in this function
      
      Indeed, if mq_rq->ioc_count is zero, an uninitialized value will be
      stored in mq_rq->drv_op_result and passed to blk_end_request_all().
      
      Can mq_rq->ioc_count be zero?
        - mmc_blk_ioctl_cmd() sets ioc_count to 1, so this is safe,
        - mmc_blk_ioctl_multi_cmd() obtains ioc_count from user space in
          response to the MMC_IOC_MULTI_CMD ioctl, and does allow zero.
      
      To avoid returning an uninitialized value, and as it is pointless to do
      all this work when the MMC_IOC_MULTI_CMD ioctl is used with zero
      entries, check for this early in mmc_blk_ioctl_multi_cmd(), and return
      zero, like was returned before.
      
      Fixes: 3ecd8cf2 ("mmc: block: move multi-ioctl() to use block layer")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      aab2ee03
    • G
      mmc: block: Initialize ret in mmc_blk_issue_drv_op() for MMC_DRV_OP_IOCTL · 7432b49b
      Geert Uytterhoeven 提交于
      With gcc 4.1.2:
      
          drivers/mmc/core/block.c: In function ‘mmc_blk_issue_drv_op’:
          drivers/mmc/core/block.c:1178: warning: ‘ret’ may be used uninitialized in this function
      
      Indeed, for MMC_DRV_OP_IOCTL, if mq_rq->ioc_count is zero, an
      uninitialized value will be stored in mq_rq->drv_op_result and passed to
      blk_end_request_all().
      
      Can mq_rq->ioc_count be zero?
        - mmc_blk_ioctl_cmd() sets ioc_count to 1, so this is safe,
        - mmc_blk_ioctl_multi_cmd() obtains ioc_count from user space in
          response to the MMC_IOC_MULTI_CMD ioctl, and does allow zero.
      
      Initialize ret to zero to fix this for current and future callers.
      
      Fixes: 0493f6fe ("mmc: block: Move boot partition locking into a driver op")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      7432b49b
  2. 28 6月, 2017 1 次提交
  3. 20 6月, 2017 33 次提交
  4. 09 6月, 2017 1 次提交
    • C
      block: introduce new block status code type · 2a842aca
      Christoph Hellwig 提交于
      Currently we use nornal Linux errno values in the block layer, and while
      we accept any error a few have overloaded magic meanings.  This patch
      instead introduces a new  blk_status_t value that holds block layer specific
      status codes and explicitly explains their meaning.  Helpers to convert from
      and to the previous special meanings are provided for now, but I suspect
      we want to get rid of them in the long run - those drivers that have a
      errno input (e.g. networking) usually get errnos that don't know about
      the special block layer overloads, and similarly returning them to userspace
      will usually return somethings that strictly speaking isn't correct
      for file system operations, but that's left as an exercise for later.
      
      For now the set of errors is a very limited set that closely corresponds
      to the previous overloaded errno values, but there is some low hanging
      fruite to improve it.
      
      blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse
      typechecking, so that we can easily catch places passing the wrong values.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      2a842aca
  5. 23 5月, 2017 1 次提交
  6. 25 4月, 2017 2 次提交