Commit Graph

220244 Commits

Author SHA1 Message Date
araujo
d47eafbc02 Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-04-20 01:05:54 +00:00
cem
b114a1a94b linprocfs_doproclimits: Initialize error return before use
Reported by:	Coverity
CID:		1354623
Sponsored by:	EMC / Isilon Storage Division
2016-04-20 01:03:06 +00:00
cem
e29b299614 linprocfs: Don't print uninitialized values
Reported by:	Coverity
CID:		1354624
Sponsored by:	EMC / Isilon Storage Division
2016-04-20 01:00:13 +00:00
araujo
dc41c66320 Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-04-20 00:55:35 +00:00
ngie
f1d4f395a6 Don't leak fd on sectorsize malloc failure
Also, call endfsent after calling getfsent (i.e. when not explicitly called
with a swap device) for code cleanliness

CID: 1354785
Differential Revision: https://reviews.freebsd.org/D6014
X-MFC with: r298076
Reported by: Coverity
Reviewed by: cem
Sponsored by: EMC / Isilon Storage Division
2016-04-20 00:49:49 +00:00
ngie
c812be1395 Fix double fclose of fp1 when freopen fails
freopen handles closing file descriptors on error, with the exception of
fdopen'ed descriptors, so closing an already fclose'd file descriptor is
incorrect

CID: 1338525
Differential Revision: https://reviews.freebsd.org/D6013
MFC after: 2 weeks
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division
2016-04-20 00:19:04 +00:00
ngie
ef837f8229 Make sure fmemopen succeeds in :test_append_binary_pos before calling ftell
on the FILE object

This fixes potential null pointer dereferences on failure

CID: 1254952
MFC after: 2 weeks
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division
2016-04-19 23:59:10 +00:00
pfg
a7d40a88c9 kernel: use our nitems() macro when it is available through param.h.
No functional change, only trivial cases are done in this sweep,

Discussed in:	freebsd-current
2016-04-19 23:48:27 +00:00
pfg
99e9a53c81 sys/boot: use our nitems() macro when it is available through param.h.
No functional change, only trivial cases are done in this sweep,

Discussed in:	freebsd-current
2016-04-19 23:44:33 +00:00
pfg
be4082c832 X86: use our nitems() macro when it is avaliable through param.h.
No functional change, only trivial cases are done in this sweep,

Discussed in:	freebsd-current
2016-04-19 23:41:46 +00:00
pfg
e2a6cba651 sys/dev: use our nitems() macro when it is avaliable through param.h.
No functional change, only trivial cases are done in this sweep,
Drivers that can get further enhancements will be done independently.

Discussed in:	freebsd-current
2016-04-19 23:37:24 +00:00
pfg
ea58c6f194 dev/agp: use our nitems() macro when it is avaliable through param.h.
Consistently capitalize the macros used in the driver.

No functional change.
2016-04-19 23:31:35 +00:00
gonzo
709b38ddd3 Fix build for Pi kernels with syscons enabled 2016-04-19 23:30:22 +00:00
ngie
d55c237423 Fix issues identified by Coverity
- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
  cached value instead of always calling getpagesize(3).
- Remove intermediate variable for assigning from $TMPDIR if set in the
  environment to eliminate warnings about pointer conversions with "/tmp",
  and to mute an invalid buffer overflow concern from Coverity
  (snprintf and tacking on a NUL terminator was alleviating that concern
  before).
- Remove useless self-test of psize before it's initialized.
- Check the return values of getrlimit/setrlimit.

Cosmetic changes:
- Replace a `(void*)0` with NULL.
- Do some minor whitespace clean up.
- Remove an unnecessary cast to mmap.
- Make all munmap calls use ATF_REQUIRE_MSG instead of using the:

  > if (munmap(..) == -1)
  >    atf_tc_fail(..)

  idiom. Employ the new idiom consistently when calling munmap.

CID: 1331351, 1331382-1331386, 1331513, 1331514, 1331565, 1331583, 1331694
Differential Revision: https://reviews.freebsd.org/D6012
MFC after: 2 weeks
Reported by: Coverity
Reviewed by: markj
Sponsored by: EMC / Isilon Storage Division
2016-04-19 23:15:47 +00:00
ngie
7638d05931 Remove trailing whitespace and use nitems(mib) instead of 2 when
calling sysctl(3)

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2016-04-19 22:59:21 +00:00
ngie
34ee6a7d22 Fix leaks and test for getpagesize() returning == -1
- close file descriptors after use.
- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
  cached value instead of always calling getpagesize(3).

CID: 1331374-1331377, 1331653-1331662
Differential Revision: https://reviews.freebsd.org/D6011
MFC after: 2 weeks
Reported by: Coverity
Reviewed by: cem
Sponsored by: EMC / Isilon Storage Division
2016-04-19 22:25:14 +00:00
pfg
f6939d2295 dev/usb: use our nitems() macro when param.h is available.
Reviewed by: hselasky
2016-04-19 22:07:36 +00:00
allanjude
650bd9e90f Link bcache into userboot.so, was not added in r298230
This should help speed up bhyve boots too

Reviewed by:	olivier
2016-04-19 20:56:45 +00:00
pfg
b92544e73f restore: use our roundup2/rounddown2() macros when param.h is available.
While here cleanup a little a malloc call.
2016-04-19 20:47:14 +00:00
jhb
b4f1b9497d Always emit an error message on passthru configuration errors.
Previously, many errors (such as the PCI device not being attached
to the ppt(4) driver) resulted in bhyve silently exiting without
starting the virtual machine.  Now any errors encountered when
configuring a virtual slot for a PCI passthru device should be noted
on stderr.

Reviewed by:	neel
Differential Revision:	https://reviews.freebsd.org/D5990
2016-04-19 20:43:05 +00:00
davidcs
6847e425cb 1. modify fwdump (a.k.a grcdump) so that grcdump memory is allocated
and freed on as needed basis.
2. grcdump can be taken at failure points by invoking bxe_grc_dump()
   when trigger_grcdump sysctl flag is set. When grcdump is taken
   grcdump_done sysctl flag is set.
3. grcdump_done can be monitored by the user to retrieve the grcdump.

Submitted by:vaishali.kulkarni@qlogic.com
2016-04-19 20:28:30 +00:00
avos
2cd2037927 net80211: do not reschedule scan_curchan_task() if the scan was canceled.
This should fix possible use-after-free in the scheduled task.

PR:		208605
2016-04-19 20:19:21 +00:00
pfg
1b24ba8d1f rtld-elf: use our roundup2() macro when param.h is available. 2016-04-19 20:12:46 +00:00
pfg
5c1c83ba38 dump: use NULL instead of zero for pointers.
Clean out the casts from calloc(3) while here.
2016-04-19 19:13:33 +00:00
pfg
d3a3a92848 fsck_msdosfs: use NULL instead of zero for pointers. 2016-04-19 19:08:37 +00:00
pfg
ab3928d0fe rtld-elf: use NULL instead of zero for pointers. 2016-04-19 19:03:55 +00:00
sbruno
2a633810e8 aacraid(4): Sanely copyin userland pointers and ensure that we don't get
anything janky from a user. (cturt)

aac(4): landergriffith+freebsdbugzilla@gmail.com pointed out that aacraid(4)
had the same issue and handling of pointers, so let's change that too.

PR:		206573
Submitted by:	cturt@hardenedbsd.org
Obtained from:	HardenedBSD
MFC after:	1 week
2016-04-19 18:27:28 +00:00
sbruno
edd3a7f3f9 Plug memory leak in ctl(4) when ctl_copyin_args() is called with a non-
null terminated ASCII string.

PR:		207626
Submitted by:	cturt@hardenedbsd.org
MFC after:	2 days
2016-04-19 16:48:14 +00:00
adrian
7b1f91ce8b [bhnd] Standardize bhnd device tables and quirk matching.
This add a bhnd device table mechanism that standardizes matching of
devices on the bhnd(4) bus, discovery of device quirk flags, and should
be pluggable into the new PNPINFO machinery.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D5759
2016-04-19 15:56:39 +00:00
adrian
240c5e5159 [bhnd] Clean up bhnd resource handling and inherited bus methods
To facilitate use by SoC implementors working with bhnd-inheriting fdt/nexus
drivers:

* Splits bhnd_bus method implementations into generic bus implementations
  (bhnd_bus_generic) and generic bhnd(4) driver implementations (bhnd_generic)
* Simplifies bhnd resource handling, allowing bhnd bus implementations to
  support bhnd resource activation by implementing the standard BUS_*
  resource APIs and BHND_BUS_ACTIVATE_RESOURCE().

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D5758
2016-04-19 15:53:57 +00:00
adrian
d094c9b381 [bhnd] Add support for specifying the address space used by bhndb children
This adds support for specifying the address space used by a bridge child;
this will either be the bridged SoC address space, or the host address space
required by children that map non SoC-address ranges from the PCI BAR.

This is necessary to support SROM/OTP child devices that live directly
beneath the bhndb device and require access to host resources, instead
of the standard behavior of delegating access to the bridged SoC address
space.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D5757
2016-04-19 15:52:55 +00:00
allanjude
9f3ad97e48 Fix pc98 build error introduced in r298230
Submitted by:	Toomas Soome <tsoome@me.com>
Spotted by:	bz
Differential Revision:	https://reviews.freebsd.org/D6002
2016-04-19 15:46:21 +00:00
br
97143cf924 Revert r298268 (Add optional chip_select/deselect methods).
None of supported hardware do require that.
2016-04-19 15:39:46 +00:00
br
d5e156f98e Assert CS for single transfers. 2016-04-19 15:36:18 +00:00
loos
5404d56e14 Use GPIOTOGGLE to toggle the pin state instead of read, modify and write. 2016-04-19 15:18:31 +00:00
trasz
41d99db047 Mention fsck_ffs -E in tunefs(8). It's non-obvious that one should
use it after enabling TRIM.

Reviewed by:	brueffer@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5928
2016-04-19 15:08:35 +00:00
loos
cf2857955c Add PCI ID for family 10h model 30h to amdtemp(4).
This adds support to CPU found in PC Engines APU2 series.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications (Netgate)
2016-04-19 15:07:04 +00:00
br
1d218a20c7 Add driver for Xilinx AXI Quad SPI device. The device was found in
lowRISC hardware.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-04-19 14:47:08 +00:00
br
28789cdc9e Add optional chip_select/deselect methods. This is required
when we want to keep CS asserted for multiple transfers.
2016-04-19 14:18:12 +00:00
trasz
8298725669 Fix debugging printf.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-04-19 13:36:31 +00:00
kib
b69824cf4d Fix umtx lock/trylock for compat32.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2016-04-19 11:37:43 +00:00
araujo
660f37b59d Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-04-19 11:12:57 +00:00
araujo
400b711861 Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-04-19 09:43:51 +00:00
sephe
dced14581e hyperv/vmbus: Make device probe/attach synchronous w/ vmbus attach/SYSINIT
Discussed with:	Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-19 09:42:48 +00:00
sephe
4a9731a7d4 hyperv: Remove two assign-only local variables
Submitted by:	Jun Su <junsu microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-04-19 09:25:56 +00:00
delphij
9454d2f01e Fix build breakage introduced by r298253. 2016-04-19 07:28:39 +00:00
araujo
9d4d4d7d3a Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-04-19 06:34:31 +00:00
araujo
fd1c51c97b Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-04-19 06:32:35 +00:00
eadler
27483b1441 Rename units.lib -> definitions.units
- this matches GNU units 2.12
add ISO country codes from units 2.12
2016-04-19 05:18:12 +00:00
eadler
bf4d4b4498 Rename units.lib -> definitions.units
- this matches GNU units 2.12
add ISO country codes from units 2.12
2016-04-19 05:17:59 +00:00