1. 14 2月, 2018 1 次提交
    • C
      scsi: pmcraid: remove redundant initializations of pointer 'ioadl' · b22ee87d
      Colin Ian King 提交于
      There are several occurrances where pointer ioadl is initialized with a
      value that is never read and where it is re-assigned a new value later
      on, hence the initialization is redundant and can be removed.
      
      Cleans up clang warnings:
      drivers/scsi/pmcraid.c:1028:29: warning: Value stored to 'ioadl' during
      its initialization is never read
      drivers/scsi/pmcraid.c:3178:29: warning: Value stored to 'ioadl' during
      its initialization is never read
      drivers/scsi/pmcraid.c:5495:29: warning: Value stored to 'ioadl' during
      its initialization is never read
      drivers/scsi/pmcraid.c:5668:29: warning: Value stored to 'ioadl' during
      its initialization is never read
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      b22ee87d
  2. 08 12月, 2017 1 次提交
  3. 22 11月, 2017 1 次提交
    • K
      treewide: Remove TIMER_FUNC_TYPE and TIMER_DATA_TYPE casts · 841b86f3
      Kees Cook 提交于
      With all callbacks converted, and the timer callback prototype
      switched over, the TIMER_FUNC_TYPE cast is no longer needed,
      so remove it. Conversion was done with the following scripts:
      
          perl -pi -e 's|\(TIMER_FUNC_TYPE\)||g' \
              $(git grep TIMER_FUNC_TYPE | cut -d: -f1 | sort -u)
      
          perl -pi -e 's|\(TIMER_DATA_TYPE\)||g' \
              $(git grep TIMER_DATA_TYPE | cut -d: -f1 | sort -u)
      
      The now unused macros are also dropped from include/linux/timer.h.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      841b86f3
  4. 02 11月, 2017 1 次提交
  5. 25 8月, 2017 1 次提交
  6. 08 8月, 2017 1 次提交
  7. 09 5月, 2017 1 次提交
  8. 25 4月, 2017 5 次提交
    • A
      scsi: pmcraid: use normal copy_from_user · edb88cef
      Arnd Bergmann 提交于
      As pointed out by Al Viro for my previous series, the driver has no need
      to call access_ok() and __copy_from_user()/__copy_to_user(). Changing
      it to regular copy_from_user()/copy_to_user() simplifies the code without
      any real downsides, making it less error-prone at best.
      
      This patch by itself also addresses the warning about the access_ok()
      macro on MIPS, but both fixes improve the code, so ideally we apply
      them both.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      edb88cef
    • A
      scsi: pmcraid: fix minor sparse warnings · 144b139c
      Arnd Bergmann 提交于
      pmcraid_minor is only used in this one file and should be 'static' as suggested
      by sparse:
      
      drivers/scsi/pmcraid.c:80:1: warning: symbol 'pmcraid_minor' was not declared. Should it be static?
      
      In Linux coding style, a literal '0' integer should not be used to represent
      a NULL pointer:
      
      drivers/scsi/pmcraid.c:348:29: warning: Using plain integer as NULL pointer
      drivers/scsi/pmcraid.c:4824:49: warning: Using plain integer as NULL pointer
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      144b139c
    • A
      scsi: pmcraid: fix endianess sparse annotations · 45c80be6
      Arnd Bergmann 提交于
      The use of le32_to_cpu() etc in this driver looks completely arbitrary.
      It may have made sense at some point, but it is not applied consistently,
      so this driver presumably won't work on big-endian kernel builds.
      
      Unfortunately it's unclear whether the type names or the calls to
      le32_to_cpu() are the correct ones. I'm taking educated guesses here
      and assume that most of the __le32 and __le16 annotations are correct,
      adding the conversion helpers whereever we access those fields.
      
      The exceptions are the 'fw_version' field that is always accessed as
      big-endian, so I'm changing the type here, and the 'hrrq' values that
      are accessed as little-endian, so I'm changing those the other way.
      
      None of these changes should have any effect on little-endian
      architectures like x86, but it addresses the sparse warnings.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      45c80be6
    • A
      scsi: pmcraid: use __iomem pointers for ioctl argument · 3397623b
      Arnd Bergmann 提交于
      kernelci.org reports a new compile warning for old code in the pmcraid
      driver:
      
      arch/mips/include/asm/uaccess.h:138:21: warning: passing argument 1 of '__access_ok' makes pointer from integer without a cast [-Wint-conversion]
      
      The warning got introduced by a cleanup to the access_ok() helper that
      requires the argument to be a pointer, where the old version silently
      accepts 'unsigned long' arguments as it still does on most other
      architectures.
      
      The new behavior in MIPS however seems absolutely sensible, and so far I
      could only find one other file with the same issue, so the best solution
      seems to be to clean up the pmcraid driver.
      
      This makes the driver consistently use 'void __iomem *' pointers for
      passing around the address of the user space ioctl arguments, which gets
      rid of the kernelci warning as well as several sparse warnings.
      
      Fixes: f0a955f4 ("mips: sanitize __access_ok()")
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      3397623b
    • C
      scsi: pmcraid: fix lock imbalance in pmcraid_reset_reload() · 91402608
      Christoph Hellwig 提交于
      sparse found a bug that has always been present since the driver was
      merged:
      
      drivers/scsi/pmcraid.c:2353:12: warning: context imbalance in 'pmcraid_reset_reload' - different lock contexts for basic block
      
      Fix this by using a common unlock goto label, and also reduce the
      indentation level in the function.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      91402608
  9. 10 1月, 2017 1 次提交
  10. 23 11月, 2016 1 次提交
  11. 28 10月, 2016 3 次提交
    • J
      genetlink: mark families as __ro_after_init · 56989f6d
      Johannes Berg 提交于
      Now genl_register_family() is the only thing (other than the
      users themselves, perhaps, but I didn't find any doing that)
      writing to the family struct.
      
      In all families that I found, genl_register_family() is only
      called from __init functions (some indirectly, in which case
      I've add __init annotations to clarifly things), so all can
      actually be marked __ro_after_init.
      
      This protects the data structure from accidental corruption.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      56989f6d
    • J
      genetlink: statically initialize families · 489111e5
      Johannes Berg 提交于
      Instead of providing macros/inline functions to initialize
      the families, make all users initialize them statically and
      get rid of the macros.
      
      This reduces the kernel code size by about 1.6k on x86-64
      (with allyesconfig).
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      489111e5
    • J
      genetlink: no longer support using static family IDs · a07ea4d9
      Johannes Berg 提交于
      Static family IDs have never really been used, the only
      use case was the workaround I introduced for those users
      that assumed their family ID was also their multicast
      group ID.
      
      Additionally, because static family IDs would never be
      reserved by the generic netlink code, using a relatively
      low ID would only work for built-in families that can be
      registered immediately after generic netlink is started,
      which is basically only the control family (apart from
      the workaround code, which I also had to add code for so
      it would reserve those IDs)
      
      Thus, anything other than GENL_ID_GENERATE is flawed and
      luckily not used except in the cases I mentioned. Move
      those workarounds into a few lines of code, and then get
      rid of GENL_ID_GENERATE entirely, making it more robust.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a07ea4d9
  12. 04 9月, 2016 1 次提交
    • B
      scsi: pmcraid: mark symbols static where possible · 61b96d5b
      Baoyou Xie 提交于
      We get 4 warnings about global functions without a declaration
      in the scsi pmcraid driver when building with W=1:
      drivers/scsi/pmcraid.c:309:6: warning: no previous prototype for 'pmcraid_init_cmdblk' [-Wmissing-prototypes]
      drivers/scsi/pmcraid.c:404:6: warning: no previous prototype for 'pmcraid_return_cmd' [-Wmissing-prototypes]
      drivers/scsi/pmcraid.c:1713:6: warning: no previous prototype for 'pmcraid_ioasc_logger' [-Wmissing-prototypes]
      drivers/scsi/pmcraid.c:3141:1: warning: no previous prototype for 'pmcraid_init_ioadls' [-Wmissing-prototypes]
      
      In fact, these functions are only used in the file in which it is
      declared and don't need a declaration, but can be made static.  so this
      patch marks it 'static'.
      Signed-off-by: NBaoyou Xie <baoyou.xie@linaro.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      61b96d5b
  13. 12 11月, 2015 1 次提交
    • A
      scsi: pmcraid: replace struct timeval with ktime_get_real_seconds() · 9c9bd593
      Alison Schofield 提交于
      Replace the use of struct timeval and do_gettimeofday() with
      64 bit ktime_get_real_seconds. Prevents 32-bit type overflow
      in year 2038 on 32-bit systems.
      
      Driver was using the seconds portion of struct timeval (.tv_secs)
      to pass a millseconds timestamp to the firmware. This change maintains
      that same behavior using ktime_get_real_seconds.
      
      The structure used to pass the timestamp to firmware is 48 bits and
      works fine as long as the top 16 bits are zero and they will be zero
      for a long time..ie. thousands of years.
      
      Alternative Change:  Add sub second granularity to timestamp
      
      As noted above, the driver only used the seconds portion of timeval,
      ignores the microseconds portion, and by multiplying by 1000 effectively
      does a <<10 and always writes zero into timestamp[0].
      
      The alternative change would pass all the bits to the firmware:
      
              struct timespec64 ts;
      
              ktime_get_real_ts64(&ts);
              timestamp = ts.tv_sec * MSEC_PER_SEC + ts.tv_nsec / NSEC_PER_MSEC;
      Signed-off-by: NAlison Schofield <amsfield22@gmail.com>
      Reviewed-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      9c9bd593
  14. 10 11月, 2015 1 次提交
  15. 20 1月, 2015 1 次提交
  16. 18 1月, 2015 1 次提交
    • J
      netlink: make nlmsg_end() and genlmsg_end() void · 053c095a
      Johannes Berg 提交于
      Contrary to common expectations for an "int" return, these functions
      return only a positive value -- if used correctly they cannot even
      return 0 because the message header will necessarily be in the skb.
      
      This makes the very common pattern of
      
        if (genlmsg_end(...) < 0) { ... }
      
      be a whole bunch of dead code. Many places also simply do
      
        return nlmsg_end(...);
      
      and the caller is expected to deal with it.
      
      This also commonly (at least for me) causes errors, because it is very
      common to write
      
        if (my_function(...))
          /* error condition */
      
      and if my_function() does "return nlmsg_end()" this is of course wrong.
      
      Additionally, there's not a single place in the kernel that actually
      needs the message length returned, and if anyone needs it later then
      it'll be very easy to just use skb->len there.
      
      Remove this, and make the functions void. This removes a bunch of dead
      code as described above. The patch adds lines because I did
      
      -	return nlmsg_end(...);
      +	nlmsg_end(...);
      +	return 0;
      
      I could have preserved all the function's return values by returning
      skb->len, but instead I've audited all the places calling the affected
      functions and found that none cared. A few places actually compared
      the return value with <= 0 in dump functionality, but that could just
      be changed to < 0 with no change in behaviour, so I opted for the more
      efficient version.
      
      One instance of the error I've made numerous times now is also present
      in net/phonet/pn_netlink.c in the route_dumpit() function - it didn't
      check for <0 or <=0 and thus broke out of the loop every single time.
      I've preserved this since it will (I think) have caused the messages to
      userspace to be formatted differently with just a single message for
      every SKB returned to userspace. It's possible that this isn't needed
      for the tools that actually use this, but I don't even know what they
      are so couldn't test that changing this behaviour would be acceptable.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      053c095a
  17. 04 12月, 2014 1 次提交
  18. 24 11月, 2014 1 次提交
  19. 12 11月, 2014 4 次提交
  20. 17 9月, 2014 2 次提交
  21. 09 8月, 2014 1 次提交
  22. 18 7月, 2014 1 次提交
  23. 29 11月, 2013 2 次提交
    • M
      [SCSI] Disable WRITE SAME for RAID and virtual host adapter drivers · 54b2b50c
      Martin K. Petersen 提交于
      Some host adapters do not pass commands through to the target disk
      directly. Instead they provide an emulated target which may or may not
      accurately report its capabilities. In some cases the physical device
      characteristics are reported even when the host adapter is processing
      commands on the device's behalf. This can lead to adapter firmware hangs
      or excessive I/O errors.
      
      This patch disables WRITE SAME for devices connected to host adapters
      that provide an emulated target. Driver writers can disable WRITE SAME
      by setting the no_write_same flag in the host adapter template.
      
      [jejb: fix up rejections due to eh_deadline patch]
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      54b2b50c
    • J
      genetlink/pmcraid: use proper genetlink multicast API · 5e53e689
      Johannes Berg 提交于
      The pmcraid driver is abusing the genetlink API and is using its
      family ID as the multicast group ID, which is invalid and may
      belong to somebody else (and likely will.)
      
      Make it use the correct API, but since this may already be used
      as-is by userspace, reserve a family ID for this code and also
      reserve that group ID to not break userspace assumptions.
      
      My previous patch broke event delivery in the driver as I missed
      that it wasn't using the right API and forgot to update it later
      in my series.
      
      While changing this, I noticed that the genetlink code could use
      the static group ID instead of a strcmp(), so also do that for
      the VFS_DQUOT family.
      
      Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5e53e689
  24. 20 11月, 2013 1 次提交
  25. 14 10月, 2013 1 次提交
  26. 18 6月, 2013 1 次提交
  27. 30 4月, 2013 1 次提交
  28. 04 1月, 2013 1 次提交
    • G
      Drivers: scsi: remove __dev* attributes. · 6f039790
      Greg Kroah-Hartman 提交于
      CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
      markings need to be removed.
      
      This change removes the use of __devinit, __devexit_p, __devinitdata,
      __devinitconst, and __devexit from these drivers.
      
      Based on patches originally written by Bill Pemberton, but redone by me
      in order to handle some of the coding style issues better, by hand.
      
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Cc: Adam Radford <linuxraid@lsi.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f039790
  29. 21 8月, 2012 1 次提交
    • T
      workqueue: deprecate flush[_delayed]_work_sync() · 43829731
      Tejun Heo 提交于
      flush[_delayed]_work_sync() are now spurious.  Mark them deprecated
      and convert all users to flush[_delayed]_work().
      
      If you're cc'd and wondering what's going on: Now all workqueues are
      non-reentrant and the regular flushes guarantee that the work item is
      not pending or running on any CPU on return, so there's no reason to
      use the sync flushes at all and they're going away.
      
      This patch doesn't make any functional difference.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Mattia Dongili <malattia@linux.it>
      Cc: Kent Yoder <key@linux.vnet.ibm.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Cc: Bryan Wu <bryan.wu@canonical.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Alasdair Kergon <agk@redhat.com>
      Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
      Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: linux-wireless@vger.kernel.org
      Cc: Anton Vorontsov <cbou@mail.ru>
      Cc: Sangbeom Kim <sbkim73@samsung.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Petr Vandrovec <petr@vandrovec.name>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Avi Kivity <avi@redhat.com> 
      43829731