]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoInvoke _OSC on Host-PCI bridges.
John Baldwin [Wed, 20 Apr 2016 20:58:30 +0000 (20:58 +0000)]
Invoke _OSC on Host-PCI bridges.

Tell the firmware that we support PCI-express config space access
and MSI.

Reviewed by: jkim
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6023

8 years agoFix bad checking of the return of realloc(3)
Baptiste Daroussin [Wed, 20 Apr 2016 20:56:06 +0000 (20:56 +0000)]
Fix bad checking of the return of realloc(3)

Reported by: Coverity
CID: 1007335
MFC after: 3 days

8 years agoAdd a wrapper for evaluating _OSC methods.
John Baldwin [Wed, 20 Apr 2016 20:55:58 +0000 (20:55 +0000)]
Add a wrapper for evaluating _OSC methods.

This wrapper does not translate errors in the first word to ACPI
error status returns.  Use this wrapper in the acpi_cpu(4) driver in
place of the existing _OSC code.  While here, fix a bug where the wrong
count of words was passed when invoking _OSC.

Reviewed by: jkim
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6022

8 years agoFix typo: actually test the return of strchr(3)
Baptiste Daroussin [Wed, 20 Apr 2016 20:54:47 +0000 (20:54 +0000)]
Fix typo: actually test the return of strchr(3)

Reported by: Coverity
CID: 1007335
MFC after: 3 days

8 years agoFix coverity issue with contrib/netbsd-tests/lib/libc/ssp/h_read.c
Enji Cooper [Wed, 20 Apr 2016 20:48:54 +0000 (20:48 +0000)]
Fix coverity issue with contrib/netbsd-tests/lib/libc/ssp/h_read.c

Ensure opening /dev/zero succeeds. Abort the test if it doesn't.

Also, use _PATH_DEVZERO instead of hardcoding "/dev/zero"

MFC after: 2 weeks
CID: 1251410
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division"

8 years agoCheck the returned value of memchr(3) before using it
Baptiste Daroussin [Wed, 20 Apr 2016 20:44:30 +0000 (20:44 +0000)]
Check the returned value of memchr(3) before using it

Reported by: Coverity
CID: 1338530

8 years agoFix coverity issues with contrib/netbsd-tests/lib/libc/sys/t_connect.c
Enji Cooper [Wed, 20 Apr 2016 20:43:05 +0000 (20:43 +0000)]
Fix coverity issues with contrib/netbsd-tests/lib/libc/sys/t_connect.c

- Ensure socket(2) calls succeed
- Don't leak slist allocated by earlier socket(2) call

MFC after: 2 weeks
CID: 976773, 1251405
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove unused e500_event_codes_size.
Pedro F. Giffuni [Wed, 20 Apr 2016 20:37:58 +0000 (20:37 +0000)]
Remove unused e500_event_codes_size.

Found by: jhb

8 years agonet80211: provide descriptions for reason codes
Andriy Voskoboinyk [Wed, 20 Apr 2016 20:30:18 +0000 (20:30 +0000)]
net80211: provide descriptions for reason codes

Add text description for deauth/disassoc/etc reason codes
in addition to 'reason: <number>' string.

Reviewed by: adrian
Obtained from: IEEE Std 802.11-2012, 8.4.1.7 "Reason Code field"
Differential Revision: https://reviews.freebsd.org/D5367

8 years agoAdd missing function prototypes in KGDB
Wojciech Macek [Wed, 20 Apr 2016 20:22:48 +0000 (20:22 +0000)]
Add missing function prototypes in KGDB

This fixes the build broken by r298358

8 years agoUpdate comment added in r298357
Ed Maste [Wed, 20 Apr 2016 19:21:26 +0000 (19:21 +0000)]
Update comment added in r298357

The additional regex replacements are actully required due to an
elfcopy bug which is now fixed (by r298361), not a Clang/GCC issue.

Sponsored by: The FreeBSD Foundation

8 years agoelfcopy: map all !alnum characters to '_' in binary input symbol names
Ed Maste [Wed, 20 Apr 2016 19:13:00 +0000 (19:13 +0000)]
elfcopy: map all !alnum characters to '_' in binary input symbol names

This matches bfd and gold.

Obtained from: ELF Tool Chain r3445
Sponsored by: The FreeBSD Foundation

8 years agonet80211 (trivial, noop): remove duplicate check from hostap_recv_mgmt()
Andriy Voskoboinyk [Wed, 20 Apr 2016 18:48:39 +0000 (18:48 +0000)]
net80211 (trivial, noop): remove duplicate check from hostap_recv_mgmt()

Differential Revision: https://reviews.freebsd.org/D5483

8 years agonet80211: replace internal LE_READ_*/LE_WRITE_* macro with system
Andriy Voskoboinyk [Wed, 20 Apr 2016 18:29:30 +0000 (18:29 +0000)]
net80211: replace internal LE_READ_*/LE_WRITE_* macro with system
le*dec / le*enc functions.

Replace net80211 specific macros with system-wide bytestream
encoding/decoding functions:
- LE_READ_2 ->  le16dec
- LE_READ_4 ->  le32dec
- LE_WRITE_2 -> le16enc
- LE_WRITE_4 -> le32enc

+ drop ieee80211_input.h include, where it was included for these
operations only.

Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D6030

8 years agoFix KGDB backtrace on ARM
Wojciech Macek [Wed, 20 Apr 2016 17:58:13 +0000 (17:58 +0000)]
Fix KGDB backtrace on ARM

Modify trapframe decoding to properly analyze trapframe.

Provide method for fixup_pc. It happens, that in some kernel
functions, the GDB stack frame decoder cannot determine both
func name and frame size. This is because these functions
either contain invalid instruction, or their format does
not match standard schema. Detect that scenarios and move
PC accordingly to jump into known function schema, which
GDB is able to parse.

Obtained from:         Semihalf
Sponsored by:          Juniper Networks
Reviewed by:           kib, zbb
Differential Revision: https://reviews.freebsd.org/D5976

8 years agoFix MFS symbol redefinition with clang 3.8.0
Wojciech Macek [Wed, 20 Apr 2016 17:54:53 +0000 (17:54 +0000)]
Fix MFS symbol redefinition with clang 3.8.0

Newest CLANG objcpy uses different name parsing.
Modify regexp to match (i.e. avoid substitution
of "/" or "-" with "_").

Obtained from:         Semihalf
Sponsored by:          Juniper Networks
Reviewed by:           hselasky, zbb
Differential Revision: https://reviews.freebsd.org/D5873

8 years agoArm and arm64 both have fueword() implemented for some time. Correct
Konstantin Belousov [Wed, 20 Apr 2016 17:28:21 +0000 (17:28 +0000)]
Arm and arm64 both have fueword() implemented for some time.  Correct
the comment.

Sponsored by: The FreeBSD Foundation

8 years agoDon't use SYSDIR to avoid conflicts with existing usage.
Peter Grehan [Wed, 20 Apr 2016 17:05:32 +0000 (17:05 +0000)]
Don't use SYSDIR to avoid conflicts with existing usage.
Also, use SRCTOP to locate the top of the source tree
instead of a relative path.

PR: 208856

8 years agoIndentation issues.
Pedro F. Giffuni [Wed, 20 Apr 2016 16:19:44 +0000 (16:19 +0000)]
Indentation issues.

Contract some lines leftover from r298310.

Mea culpa.

8 years agoMinor indentation issue.
Pedro F. Giffuni [Wed, 20 Apr 2016 16:03:53 +0000 (16:03 +0000)]
Minor indentation issue.

8 years agoUse our nitems() macro when param.h is available.
Pedro F. Giffuni [Wed, 20 Apr 2016 15:45:55 +0000 (15:45 +0000)]
Use our nitems() macro when param.h is available.

Replacements specific to arm, mips, pc98, powerpc and sparc64.

Discussed in: freebsd-current

8 years agoAvoid a possible heap overflow in our nlm code by limiting the number
Sean Bruno [Wed, 20 Apr 2016 15:31:03 +0000 (15:31 +0000)]
Avoid a possible heap overflow in our nlm code by limiting the number
of service to the arbitrary value of 256.  Log an appropriate message
that indicates the hard limit.

PR: 208808
Submitted by: cturt@hardenedbsd.org
Reviewed by: dfr
Obtained from: HardenedBSD
MFC after: 2 weeks

8 years agoAdd compat strings used by OpenWRT to some Mediatek/Ralink drivers
Stanislav Galabov [Wed, 20 Apr 2016 14:47:16 +0000 (14:47 +0000)]
Add compat strings used by OpenWRT to some Mediatek/Ralink drivers

Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D5995

8 years agoRework mtk_gpio_v1 driver
Stanislav Galabov [Wed, 20 Apr 2016 14:36:45 +0000 (14:36 +0000)]
Rework mtk_gpio_v1 driver

This revision makes the mtk_gpio_v1 driver read its register map property
from the OpenWRT dts files.

Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D6029

8 years agoIntroduce OpenWRT compatible pinctrl driver for Mediatek/Ralink SoCs
Stanislav Galabov [Wed, 20 Apr 2016 14:35:00 +0000 (14:35 +0000)]
Introduce OpenWRT compatible pinctrl driver for Mediatek/Ralink SoCs

The driver can read and parse the OpenWRT pinctrl dts entries.

Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D5999

8 years agoModify mx25l FDT compatible device handling
Stanislav Galabov [Wed, 20 Apr 2016 14:33:00 +0000 (14:33 +0000)]
Modify mx25l FDT compatible device handling

If we cannot establish compatibility by only looking at the compat_data we
also check the flash_devices structure's names for a compatible device.

Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D6026

8 years agoInclude resets and clocks properties for PCI in FreeBSD RT3883 dtsi file
Stanislav Galabov [Wed, 20 Apr 2016 14:31:01 +0000 (14:31 +0000)]
Include resets and clocks properties for PCI in FreeBSD RT3883 dtsi file

This change is required so that RT3662/RT3883 PCI can function correctly

Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D6028

8 years agoChange OpenWRT imported dtsi files
Stanislav Galabov [Wed, 20 Apr 2016 14:29:03 +0000 (14:29 +0000)]
Change OpenWRT imported dtsi files

Change '#include <fbsd-*>' to '/include/ "fbsd-*"' in [rm]t*.dtsi

Basically the pre-import work on OpenWRT's dts/dtsi files boils down to:

for f in `ls [mr]t*.dtsi`; do
printf '\n/include/ "fbsd-$f"\n' >> $f
done

Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D5993

8 years agoGroup the ThunderX PCIe PEM newbus methods to help find them.
Andrew Turner [Wed, 20 Apr 2016 14:12:40 +0000 (14:12 +0000)]
Group the ThunderX PCIe PEM newbus methods to help find them.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoPull out the MSI/MSI-X handling calls to simplify future intrng
Andrew Turner [Wed, 20 Apr 2016 13:23:06 +0000 (13:23 +0000)]
Pull out the MSI/MSI-X handling calls to simplify future intrng
integration.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoFix inverted priv check calls. Priv check returns zero on success and
Hans Petter Selasky [Wed, 20 Apr 2016 07:44:50 +0000 (07:44 +0000)]
Fix inverted priv check calls. Priv check returns zero on success and
an error code on failure. Refer to man 9 priv_check .

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoUpdate the bhyve(8) man page:
Roman Bogorodskiy [Wed, 20 Apr 2016 06:29:03 +0000 (06:29 +0000)]
Update the bhyve(8) man page:

 - Document powering off by sending SIGTERM signal
 - Document exit codes

Reviewed by: wblock, neel
Approved by: wblock
Differential Revision: D5982

8 years agosym(4): Don't double-free 'sim' in failure case
Conrad Meyer [Wed, 20 Apr 2016 05:13:36 +0000 (05:13 +0000)]
sym(4): Don't double-free 'sim' in failure case

Reported by: Coverity
CID: 1006106
Sponsored by: EMC / Isilon Storage Division

8 years agosound(4): Don't use-after-free in midi module unload
Conrad Meyer [Wed, 20 Apr 2016 05:11:00 +0000 (05:11 +0000)]
sound(4): Don't use-after-free in midi module unload

Also, use ANSI function parameter definitions (void) while here.

Reported by: Coverity
CID: 1006107
Sponsored by: EMC / Isilon Storage Division

8 years agokgssapi(4): Don't allow user-provided arguments to overrun stack buffer
Conrad Meyer [Wed, 20 Apr 2016 05:02:13 +0000 (05:02 +0000)]
kgssapi(4): Don't allow user-provided arguments to overrun stack buffer

An over-long path argument to gssd_syscall could overrun the stack sockaddr_un
buffer.  Fix gssd_syscall to not permit that.

If an over-long path is provided, gssd_syscall now returns EINVAL.

It looks like PRIV_NFS_DAEMON isn't granted anywhere, so my best guess is that
this is likely only triggerable by root.

Reported by: Coverity
CID: 1006751
Sponsored by: EMC / Isilon Storage Division

8 years agopty(4): Use strlcpy to guarantee destination buffer isn't overrun
Conrad Meyer [Wed, 20 Apr 2016 04:50:33 +0000 (04:50 +0000)]
pty(4): Use strlcpy to guarantee destination buffer isn't overrun

The devtoname() name is strcpyed into a small stack buffer.  Sure, we always
expect the name to be ttyXX (or ptyXX).  If that's the case, strlcpy() doesn't
hurt.

Reported by: Coverity
CID: 1006768
Sponsored by: EMC / Isilon Storage Division

8 years agokgssapi(4): Fix string overrun in Kerberos principal construction
Conrad Meyer [Wed, 20 Apr 2016 04:45:23 +0000 (04:45 +0000)]
kgssapi(4): Fix string overrun in Kerberos principal construction

'buf.value' was previously treated as a nul-terminated string, but only
allocated with strlen() space.  Rectify this.

Reported by: Coverity
CID: 1007639
Sponsored by: EMC / Isilon Storage Division

8 years agoi915kms: Fix memory leak if a CRT is detected
Conrad Meyer [Wed, 20 Apr 2016 03:48:57 +0000 (03:48 +0000)]
i915kms: Fix memory leak if a CRT is detected

Reported by: Coverity
CID: 1090729
Sponsored by: EMC / Isilon Storage Division

8 years agodrm2(4): Fix double-free in low-memory error path
Conrad Meyer [Wed, 20 Apr 2016 03:45:45 +0000 (03:45 +0000)]
drm2(4): Fix double-free in low-memory error path

Reallocf frees 'block'; don't attempt to free it again.

Reported by: Coverity
CID: 1091165
Sponsored by: EMC / Isilon Storage Division

8 years agoMake Racct macro slightly more gracious given RACCT_UNDEFINED
Conrad Meyer [Wed, 20 Apr 2016 03:24:59 +0000 (03:24 +0000)]
Make Racct macro slightly more gracious given RACCT_UNDEFINED

rctl_string_to_rule could previously index below the zeroth element of
racct_types via the macro.  Maybe it shouldn't use the macro on
RACCT_UNDEFINED.  But given every other RACCT_ definition is non-negative, it
seems pretty easy to foot-shoot this one without the check.

Reported by: Coverity
CID: 1305574
Sponsored by: EMC / Isilon Storage Division

8 years agoaesni(4): Initialize error before use
Conrad Meyer [Wed, 20 Apr 2016 03:05:32 +0000 (03:05 +0000)]
aesni(4): Initialize error before use

Reported by: Coverity
CID: 1331554
Sponsored by: EMC / Isilon Storage Division

8 years agoi915kms intel_pm: Read from actual tsc_freq instead of uninitialized local
Conrad Meyer [Wed, 20 Apr 2016 02:58:22 +0000 (02:58 +0000)]
i915kms intel_pm: Read from actual tsc_freq instead of uninitialized local

The local of the same name would alias the global, but we didn't even include
the header that defines tsc_freq.  Include it and rename the local.

Reported by: Coverity
CID: 1331559
Sponsored by: EMC / Isilon Storage Division

8 years agokern_rctl: Fix resource leak in error path
Conrad Meyer [Wed, 20 Apr 2016 02:09:38 +0000 (02:09 +0000)]
kern_rctl: Fix resource leak in error path

Ordinarily, rctl_write_outbuf frees 'sb'.  However, if we are in low memory
conditions we skip past the rctl_write_outbuf.  In that case, free 'sb'.

Reported by: Coverity
CID: 1338539
Sponsored by: EMC / Isilon Storage Division

8 years agoradix rn_inithead: Fix minor leak in low memory conditions
Conrad Meyer [Wed, 20 Apr 2016 02:01:45 +0000 (02:01 +0000)]
radix rn_inithead: Fix minor leak in low memory conditions

R_Zalloc is essentially a malloc(M_NOWAIT) wrapper.  It is possible that 'rnh'
failed to allocate, but 'rmh' succeeds.  In that case, we bail out of
rn_inithead() but previously did not free 'rmh'.

Introduced in r287073 (projects/routing) / MFP r294706.

Reported by: Coverity
CID: 1350258
Sponsored by: EMC / Isilon Storage Division

8 years agobpf_getdltlist: Don't overrun 'lst'
Conrad Meyer [Wed, 20 Apr 2016 01:39:31 +0000 (01:39 +0000)]
bpf_getdltlist: Don't overrun 'lst'

'lst' is allocated with 'n1' members.  'n' indexes 'lst'.  So 'n == n1' is an
invalid 'lst' index.  This is a follow-up to r296009.

Reported by: Coverity
CID: 1352743
Sponsored by: EMC / Isilon Storage Division

8 years agoPartially revert the change on r298325 where there is an
Marcelo Araujo [Wed, 20 Apr 2016 01:38:54 +0000 (01:38 +0000)]
Partially revert the change on r298325 where there is an
(-1) casted to a pointer.

Submitted by: pfg
MFC after: 2 weeks.

8 years agoRe-ident lines.
Marcelo Araujo [Wed, 20 Apr 2016 01:35:09 +0000 (01:35 +0000)]
Re-ident lines.

Requested by: pfg
MFC after: 2 weeks.

8 years agoUse NULL instead of 0 for pointers.
Marcelo Araujo [Wed, 20 Apr 2016 01:28:31 +0000 (01:28 +0000)]
Use NULL instead of 0 for pointers.
Small cosmetic change.

MFC after: 2 weeks.

8 years agoUse NULL instead of 0 for pointers.
Marcelo Araujo [Wed, 20 Apr 2016 01:26:03 +0000 (01:26 +0000)]
Use NULL instead of 0 for pointers.

gethostbyname(3) will return NULL for error status.

MFC after: 2 weeks.

8 years agolibc: use our roundup2/rounddown2() macros when param.h is available.
Pedro F. Giffuni [Wed, 20 Apr 2016 01:21:39 +0000 (01:21 +0000)]
libc: use our roundup2/rounddown2() macros when param.h is available.

rounddown2 tends to produce longer lines than the original code but
still it makes the code more readable.

8 years agonctgpio(4): Don't index past the end of sc->pins array
Conrad Meyer [Wed, 20 Apr 2016 01:17:18 +0000 (01:17 +0000)]
nctgpio(4): Don't index past the end of sc->pins array

This driver thinks that the NCT_MAX_PIN index is a valid index in a few places
(nct_attach() for-loop, as well as NCT_IS_VALID_PIN()).  Allocate room for
NCT_MAX_PIN as an index, that is, NCT_MAX_PIN + 1 elements.

Reported by: Coverity
CIDs: 13538061353807135380813538091353810
Sponsored by: EMC / Isilon Storage Division

8 years agoSRAT: Don't overflow domain_pxm table
Conrad Meyer [Wed, 20 Apr 2016 01:10:07 +0000 (01:10 +0000)]
SRAT: Don't overflow domain_pxm table

If we reached MAXMEMDOM, we would previously try to insert an additional
element and only detect overflow after causing (probably trivial) memory
overflow.  Instead, detect the ndomain > MAXMEMDOM case before we write past
the end.

Reported by: Coverity
CID: 1354783
Sponsored by: EMC / Isilon Storage Division

8 years agoUse nitems() from sys/param.h.
Marcelo Araujo [Wed, 20 Apr 2016 01:05:54 +0000 (01:05 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.

8 years agolinprocfs_doproclimits: Initialize error return before use
Conrad Meyer [Wed, 20 Apr 2016 01:03:06 +0000 (01:03 +0000)]
linprocfs_doproclimits: Initialize error return before use

Reported by: Coverity
CID: 1354623
Sponsored by: EMC / Isilon Storage Division

8 years agolinprocfs: Don't print uninitialized values
Conrad Meyer [Wed, 20 Apr 2016 01:00:13 +0000 (01:00 +0000)]
linprocfs: Don't print uninitialized values

Reported by: Coverity
CID: 1354624
Sponsored by: EMC / Isilon Storage Division

8 years agoUse nitems() from sys/param.h.
Marcelo Araujo [Wed, 20 Apr 2016 00:55:35 +0000 (00:55 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.

8 years agoDon't leak fd on sectorsize malloc failure
Enji Cooper [Wed, 20 Apr 2016 00:49:49 +0000 (00:49 +0000)]
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

8 years agoFix double fclose of `fp1` when freopen fails
Enji Cooper [Wed, 20 Apr 2016 00:19:04 +0000 (00:19 +0000)]
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

8 years agoMake sure fmemopen succeeds in :test_append_binary_pos before calling ftell
Enji Cooper [Tue, 19 Apr 2016 23:59:10 +0000 (23:59 +0000)]
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

8 years agokernel: use our nitems() macro when it is available through param.h.
Pedro F. Giffuni [Tue, 19 Apr 2016 23:48:27 +0000 (23:48 +0000)]
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

8 years agosys/boot: use our nitems() macro when it is available through param.h.
Pedro F. Giffuni [Tue, 19 Apr 2016 23:44:33 +0000 (23:44 +0000)]
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

8 years agoX86: use our nitems() macro when it is avaliable through param.h.
Pedro F. Giffuni [Tue, 19 Apr 2016 23:41:46 +0000 (23:41 +0000)]
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

8 years agosys/dev: use our nitems() macro when it is avaliable through param.h.
Pedro F. Giffuni [Tue, 19 Apr 2016 23:37:24 +0000 (23:37 +0000)]
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

8 years agodev/agp: use our nitems() macro when it is avaliable through param.h.
Pedro F. Giffuni [Tue, 19 Apr 2016 23:31:35 +0000 (23:31 +0000)]
dev/agp: use our nitems() macro when it is avaliable through param.h.

Consistently capitalize the macros used in the driver.

No functional change.

8 years agoFix build for Pi kernels with syscons enabled
Oleksandr Tymoshenko [Tue, 19 Apr 2016 23:30:22 +0000 (23:30 +0000)]
Fix build for Pi kernels with syscons enabled

8 years agoFix issues identified by Coverity
Enji Cooper [Tue, 19 Apr 2016 23:15:47 +0000 (23:15 +0000)]
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: 13313511331382-133138613315131331514133156513315831331694
Differential Revision: https://reviews.freebsd.org/D6012
MFC after: 2 weeks
Reported by: Coverity
Reviewed by: markj
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove trailing whitespace and use `nitems(mib)` instead of `2` when
Enji Cooper [Tue, 19 Apr 2016 22:59:21 +0000 (22:59 +0000)]
Remove trailing whitespace and use `nitems(mib)` instead of `2` when
calling sysctl(3)

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoFix leaks and test for getpagesize() returning == -1
Enji Cooper [Tue, 19 Apr 2016 22:25:14 +0000 (22:25 +0000)]
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-13313771331653-1331662
Differential Revision: https://reviews.freebsd.org/D6011
MFC after: 2 weeks
Reported by: Coverity
Reviewed by: cem
Sponsored by: EMC / Isilon Storage Division

8 years agodev/usb: use our nitems() macro when param.h is available.
Pedro F. Giffuni [Tue, 19 Apr 2016 22:07:36 +0000 (22:07 +0000)]
dev/usb: use our nitems() macro when param.h is available.

Reviewed by: hselasky

8 years agoLink bcache into userboot.so, was not added in r298230
Allan Jude [Tue, 19 Apr 2016 20:56:45 +0000 (20:56 +0000)]
Link bcache into userboot.so, was not added in r298230

This should help speed up bhyve boots too

Reviewed by: olivier

8 years agorestore: use our roundup2/rounddown2() macros when param.h is available.
Pedro F. Giffuni [Tue, 19 Apr 2016 20:47:14 +0000 (20:47 +0000)]
restore: use our roundup2/rounddown2() macros when param.h is available.

While here cleanup a little a malloc call.

8 years agoAlways emit an error message on passthru configuration errors.
John Baldwin [Tue, 19 Apr 2016 20:43:05 +0000 (20:43 +0000)]
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

8 years ago1. modify fwdump (a.k.a grcdump) so that grcdump memory is allocated
David C Somayajulu [Tue, 19 Apr 2016 20:28:30 +0000 (20:28 +0000)]
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

8 years agonet80211: do not reschedule scan_curchan_task() if the scan was canceled.
Andriy Voskoboinyk [Tue, 19 Apr 2016 20:19:21 +0000 (20:19 +0000)]
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

8 years agortld-elf: use our roundup2() macro when param.h is available.
Pedro F. Giffuni [Tue, 19 Apr 2016 20:12:46 +0000 (20:12 +0000)]
rtld-elf: use our roundup2() macro when param.h is available.

8 years agodump: use NULL instead of zero for pointers.
Pedro F. Giffuni [Tue, 19 Apr 2016 19:13:33 +0000 (19:13 +0000)]
dump: use NULL instead of zero for pointers.

Clean out the casts from calloc(3) while here.

8 years agofsck_msdosfs: use NULL instead of zero for pointers.
Pedro F. Giffuni [Tue, 19 Apr 2016 19:08:37 +0000 (19:08 +0000)]
fsck_msdosfs: use NULL instead of zero for pointers.

8 years agortld-elf: use NULL instead of zero for pointers.
Pedro F. Giffuni [Tue, 19 Apr 2016 19:03:55 +0000 (19:03 +0000)]
rtld-elf: use NULL instead of zero for pointers.

8 years agoaacraid(4): Sanely copyin userland pointers and ensure that we don't get
Sean Bruno [Tue, 19 Apr 2016 18:27:28 +0000 (18:27 +0000)]
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

8 years agoPlug memory leak in ctl(4) when ctl_copyin_args() is called with a non-
Sean Bruno [Tue, 19 Apr 2016 16:48:14 +0000 (16:48 +0000)]
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

8 years ago[bhnd] Standardize bhnd device tables and quirk matching.
Adrian Chadd [Tue, 19 Apr 2016 15:56:39 +0000 (15:56 +0000)]
[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

8 years ago[bhnd] Clean up bhnd resource handling and inherited bus methods
Adrian Chadd [Tue, 19 Apr 2016 15:53:57 +0000 (15:53 +0000)]
[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

8 years ago[bhnd] Add support for specifying the address space used by bhndb children
Adrian Chadd [Tue, 19 Apr 2016 15:52:55 +0000 (15:52 +0000)]
[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

8 years agoFix pc98 build error introduced in r298230
Allan Jude [Tue, 19 Apr 2016 15:46:21 +0000 (15:46 +0000)]
Fix pc98 build error introduced in r298230

Submitted by: Toomas Soome <tsoome@me.com>
Spotted by: bz
Differential Revision: https://reviews.freebsd.org/D6002

8 years agoRevert r298268 (Add optional chip_select/deselect methods).
Ruslan Bukin [Tue, 19 Apr 2016 15:39:46 +0000 (15:39 +0000)]
Revert r298268 (Add optional chip_select/deselect methods).
None of supported hardware do require that.

8 years agoAssert CS for single transfers.
Ruslan Bukin [Tue, 19 Apr 2016 15:36:18 +0000 (15:36 +0000)]
Assert CS for single transfers.

8 years agoUse GPIOTOGGLE to toggle the pin state instead of read, modify and write.
Luiz Otavio O Souza [Tue, 19 Apr 2016 15:18:31 +0000 (15:18 +0000)]
Use GPIOTOGGLE to toggle the pin state instead of read, modify and write.

8 years agoMention fsck_ffs -E in tunefs(8). It's non-obvious that one should
Edward Tomasz Napierala [Tue, 19 Apr 2016 15:08:35 +0000 (15:08 +0000)]
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

8 years agoAdd PCI ID for family 10h model 30h to amdtemp(4).
Luiz Otavio O Souza [Tue, 19 Apr 2016 15:07:04 +0000 (15:07 +0000)]
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)

8 years agoAdd driver for Xilinx AXI Quad SPI device. The device was found in
Ruslan Bukin [Tue, 19 Apr 2016 14:47:08 +0000 (14:47 +0000)]
Add driver for Xilinx AXI Quad SPI device. The device was found in
lowRISC hardware.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoAdd optional chip_select/deselect methods. This is required
Ruslan Bukin [Tue, 19 Apr 2016 14:18:12 +0000 (14:18 +0000)]
Add optional chip_select/deselect methods. This is required
when we want to keep CS asserted for multiple transfers.

8 years agoFix debugging printf.
Edward Tomasz Napierala [Tue, 19 Apr 2016 13:36:31 +0000 (13:36 +0000)]
Fix debugging printf.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoFix umtx lock/trylock for compat32.
Konstantin Belousov [Tue, 19 Apr 2016 11:37:43 +0000 (11:37 +0000)]
Fix umtx lock/trylock for compat32.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

8 years agoUse nitems() from sys/param.h.
Marcelo Araujo [Tue, 19 Apr 2016 11:12:57 +0000 (11:12 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.

8 years agoUse nitems() from sys/param.h.
Marcelo Araujo [Tue, 19 Apr 2016 09:43:51 +0000 (09:43 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.

8 years agohyperv/vmbus: Make device probe/attach synchronous w/ vmbus attach/SYSINIT
Sepherosa Ziehau [Tue, 19 Apr 2016 09:42:48 +0000 (09:42 +0000)]
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

8 years agohyperv: Remove two assign-only local variables
Sepherosa Ziehau [Tue, 19 Apr 2016 09:25:56 +0000 (09:25 +0000)]
hyperv: Remove two assign-only local variables

Submitted by: Jun Su <junsu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC

8 years agoFix build breakage introduced by r298253.
Xin LI [Tue, 19 Apr 2016 07:28:39 +0000 (07:28 +0000)]
Fix build breakage introduced by r298253.

8 years agoUse nitems() from sys/param.h.
Marcelo Araujo [Tue, 19 Apr 2016 06:34:31 +0000 (06:34 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.

8 years agoUse nitems() from sys/param.h.
Marcelo Araujo [Tue, 19 Apr 2016 06:32:35 +0000 (06:32 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.