]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoFix for using IPv6 addresses with RDMA:
Hans Petter Selasky [Thu, 21 Apr 2016 16:33:42 +0000 (16:33 +0000)]
Fix for using IPv6 addresses with RDMA:

IPv6 addresses has a scope ID which sometimes is stored in the
"sin6_scope_id" field of "struct sockaddr_in6" and sometimes as part
of the IPv6 address itself depending on the context. If the scope ID
is not in the expected location, the IPv6 address lookups in the
so-called GID table will fail. Some code factoring has been made to
achieve a clean exit of the "addr_resolve" function via a common
"done" label.

Sponsored by: Mellanox Technologies
Submitted by: Shani Michaeli <shanim@mellanox.com>
MFC after: 1 week

8 years agoAdd more guards to disable GELIBOOT by defining LOADER_NO_GELI_SUPPORT
Allan Jude [Thu, 21 Apr 2016 16:32:48 +0000 (16:32 +0000)]
Add more guards to disable GELIBOOT by defining LOADER_NO_GELI_SUPPORT

Reviewed by: cem
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D6049

8 years agoRemove redundant logic from the pkg-base merge.
Bryan Drewery [Thu, 21 Apr 2016 16:30:28 +0000 (16:30 +0000)]
Remove redundant logic from the pkg-base merge.

These will be set from the logic right above it.

Reviewed by: gjb
Sponsored by: EMC / Isilon Storage Division

8 years agoFix 'make -n' for new packaging targets.
Bryan Drewery [Thu, 21 Apr 2016 16:30:25 +0000 (16:30 +0000)]
Fix 'make -n' for new packaging targets.

Sponsored by: EMC / Isilon Storage Division

8 years agoAdd more missing .PHONY.
Bryan Drewery [Thu, 21 Apr 2016 16:30:16 +0000 (16:30 +0000)]
Add more missing .PHONY.

This also protects them from trying to create .meta files
with WITH_META_MODE.

Reported by: Nikolai Lifanov <lifanov@mail.lifanov.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoGet rid of rctl_lock; use racct_lock where appropriate. The fast paths
Edward Tomasz Napierala [Thu, 21 Apr 2016 16:22:52 +0000 (16:22 +0000)]
Get rid of rctl_lock; use racct_lock where appropriate. The fast paths
already required both of them, so having a separate rctl_lock didn't
buy us anything.

Reviewed by: mjg@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5914

8 years agoFollow-up r298219: Don't error with 'make all install'.
Bryan Drewery [Thu, 21 Apr 2016 16:12:55 +0000 (16:12 +0000)]
Follow-up r298219: Don't error with 'make all install'.

Reported by: kib
Sponsored by: EMC / Isilon Storage Division

8 years agoFix for resolving mac address when the destination address is a gateway.
Hans Petter Selasky [Thu, 21 Apr 2016 16:04:58 +0000 (16:04 +0000)]
Fix for resolving mac address when the destination address is a gateway.
Remove some dead code while at it.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoRemove slightly used const values that can be replaced with nitems().
Pedro F. Giffuni [Thu, 21 Apr 2016 15:38:28 +0000 (15:38 +0000)]
Remove slightly used const values that can be replaced with nitems().

Suggested by: jhb

8 years agosiba(4): remove slightly used 'bound' variable.
Pedro F. Giffuni [Thu, 21 Apr 2016 15:24:21 +0000 (15:24 +0000)]
siba(4): remove slightly used 'bound' variable.

It can be replaced with nitems(). While here simplify the function

Suggested by: jhb

8 years agoPrevent underflows in tp->snd_wnd if the remote side ACKs more than
Jonathan T. Looney [Thu, 21 Apr 2016 15:06:53 +0000 (15:06 +0000)]
Prevent underflows in tp->snd_wnd if the remote side ACKs more than
tp->snd_wnd. This can happen, for example, when the remote side responds to
a window probe by ACKing the one byte it contains.

Differential Revision: https://reviews.freebsd.org/D5625
Reviewed by: hiren
Obtained from: Juniper Networks (earlier version)
MFC after: 2 weeks
Sponsored by: Juniper Networks

8 years agoDocument r296417, clang, llvm, etc. updated to upstream 3.8.0
Steven Kreuzer [Thu, 21 Apr 2016 14:20:45 +0000 (14:20 +0000)]
Document r296417, clang, llvm, etc. updated to upstream 3.8.0

Approved by: gjb@
Differential Revision: D6037

8 years agoMake the GIC SGI global variables static, they are only ever used within
Andrew Turner [Thu, 21 Apr 2016 14:04:56 +0000 (14:04 +0000)]
Make the GIC SGI global variables static, they are only ever used within
within this file.

Approved by: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoAdjust BOOTSTRAPPING test after MFC of kbdcontrol's -P option
Ed Maste [Thu, 21 Apr 2016 13:14:55 +0000 (13:14 +0000)]
Adjust BOOTSTRAPPING test after MFC of kbdcontrol's -P option

8 years agoelftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree
Ed Maste [Thu, 21 Apr 2016 12:58:29 +0000 (12:58 +0000)]
elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree

It's provided by sys.mk so there's no need to derive it from ${.CURDIR}.

Suggested by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5998

8 years agoProperly setup arguments for if_resolvemulti() callback.
Hans Petter Selasky [Thu, 21 Apr 2016 11:32:22 +0000 (11:32 +0000)]
Properly setup arguments for if_resolvemulti() callback.

Sponsored by: Mellanox Technologies
MFC after: 1 week

8 years agoRemove stale function declaration
Andrey V. Elsukov [Thu, 21 Apr 2016 11:02:06 +0000 (11:02 +0000)]
Remove stale function declaration

8 years agoConstify mbuf pointer for IPSEC functions where mbuf isn't modified.
Andrey V. Elsukov [Thu, 21 Apr 2016 10:58:07 +0000 (10:58 +0000)]
Constify mbuf pointer for IPSEC functions where mbuf isn't modified.

8 years agoRework Mediatek/Ralink configuration files
Stanislav Galabov [Thu, 21 Apr 2016 07:40:03 +0000 (07:40 +0000)]
Rework Mediatek/Ralink configuration files

Only compile what each SoC needs and get rid of MEDIATEK generic config.

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

8 years agoRestore the original ascii.c from prior to r290494
Baptiste Daroussin [Thu, 21 Apr 2016 07:36:11 +0000 (07:36 +0000)]
Restore the original ascii.c from prior to r290494

It was doing the right thing, there was no need to "fail" to reinvent it from
none.c

Pointy hat: bapt
Submitted by: ache

8 years agoRestore histrory messed up in r290620
Baptiste Daroussin [Thu, 21 Apr 2016 06:27:06 +0000 (06:27 +0000)]
Restore histrory messed up in r290620

ascii.c was removed during r290494 but this introduced an issue with ASCII that
has been fixed in r290618 and lead to a rewrite of ascii.c based on none.c.

ascii.c was wrongly reintroduced in r290620 without proper svn operation which
lost the history.

Reported by: ache, danfe

8 years agoUse MIN()/MAX() macros from sys/param.h.
Marcelo Araujo [Thu, 21 Apr 2016 06:24:13 +0000 (06:24 +0000)]
Use MIN()/MAX() macros from sys/param.h.

MFC after: 2 weeks.

8 years agoUse MAX() from sys/param.h.
Marcelo Araujo [Thu, 21 Apr 2016 06:21:33 +0000 (06:21 +0000)]
Use MAX() from sys/param.h.

MFC after: 2 weeks.

8 years agonet80211: refresh comments for ieee80211_scan_next() and
Andriy Voskoboinyk [Thu, 21 Apr 2016 06:19:33 +0000 (06:19 +0000)]
net80211: refresh comments for ieee80211_scan_next() and
ieee80211_scan_done().

Refresh comments that reference scan_next() method
(does not exist since r191746) + fix spelling of 'current'.

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

8 years agoFix a missing blank space.
Marcelo Araujo [Thu, 21 Apr 2016 06:14:30 +0000 (06:14 +0000)]
Fix a missing blank space.

8 years agoSimplify the get_type() function.
Marcelo Araujo [Thu, 21 Apr 2016 06:11:24 +0000 (06:11 +0000)]
Simplify the get_type() function.

Submitted by: bde
Discussed with: bde, jhb and pfg
MFC after: 2 weeks.

8 years agonet80211: enable promiscuous mode state change for non-monitor/ahdemo modes
Andriy Voskoboinyk [Thu, 21 Apr 2016 05:47:47 +0000 (05:47 +0000)]
net80211: enable promiscuous mode state change for non-monitor/ahdemo modes

- Allow to enable/disable promiscuous mode when:
  * interface is not a member of bridge, or;
  * request was issued by user (ifconfig wlan0 promisc), or;
  * interface is in MONITOR or AHDEMO mode.
- Drop local workarounds in mwl(4) and malo(4).

Tested with:
- Intel 3945BG, STA mode;
- RTL8188CUS, MONITOR mode;

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

8 years agoBring a little more compability with GNU units 2.12
Eitan Adler [Thu, 21 Apr 2016 05:24:47 +0000 (05:24 +0000)]
Bring a little more compability with GNU units 2.12
- notionally support a 'history file' flag. This doesn't do much now,
  but is there to prevent scripts written against GNU units from
  breaking
- correctly gracefully quit rather than exit (this will make it easier
  to support a history file in the future)
- remove the "t" flag from fopen which was there to support windows. We
  have not supported windows since at the latest, the introduction of
  capsicum.

8 years agoRemove project.name which is a product of a bygone era.
Eitan Adler [Thu, 21 Apr 2016 04:33:07 +0000 (04:33 +0000)]
Remove project.name which is a product of a bygone era.

8 years agoAdd the address at which the routine returned.
George V. Neville-Neil [Thu, 21 Apr 2016 03:17:53 +0000 (03:17 +0000)]
Add the address at which the routine returned.

MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)

8 years agodhclient: Log a warning instead of bailing upon "illegal" options
Sepherosa Ziehau [Wed, 20 Apr 2016 23:56:25 +0000 (23:56 +0000)]
dhclient: Log a warning instead of bailing upon "illegal" options

In Azure, the DHCP servers add private option (id 0xf5), which contains
binary form of an IPv4 address. Once this option is converted to string
form, it could contain '$', e.g.

IPv4 address: 100.72.36.54
binary form: 0x64 0x48 0x24 0x36
string form: "dH$6"

dhclient bails upon "illegal" options like the above example, thus the
VM bring-up will fail.

Also as a side note, this "illegal" option detection was added in
OpenBSD ~11years ago:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.50&content-type=text/x-cvsweb-markup

And it was removed along with the removal of script support in OpenBSD
~3years ago:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.159&content-type=text/x-cvsweb-markup

Reported by: Hongxiong Xian <v-hoxian microsoft com>
Reviewed by: jhb, Dexuan Cui <decui microsoft com>
Tested by: Hongxiong Xian <v-hoxian microsoft com>
Analyzed by: Dong Liu <doliu microsoft com>
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5853

8 years agoRevert r298357
Wojciech Macek [Wed, 20 Apr 2016 22:41:19 +0000 (22:41 +0000)]
Revert r298357

Revert workaround fixed by r298361

8 years agoForce framebuffer virtual viewport to be the same as physical
Oleksandr Tymoshenko [Wed, 20 Apr 2016 22:38:00 +0000 (22:38 +0000)]
Force framebuffer virtual viewport to be the same as physical

VideoCore reports garbage in viewport geometry fields unless
viewport was set previously by earlier stage boot loader. So
when booting FreeBSD kernel directly from VideoCore's start.elf
framebuffer intialization fails due to invalid vxres, vyres
values. Make sure we request viewport to be equal to physical
resolution

Submitted by: Sylvain Garrigues <sylvain@sylvaingarrigues.com>

8 years agoPlug memory leak
Baptiste Daroussin [Wed, 20 Apr 2016 21:37:32 +0000 (21:37 +0000)]
Plug memory leak

Reported by: coverity
CID: 13316641331665

8 years agoPlug various resources leak
Baptiste Daroussin [Wed, 20 Apr 2016 21:32:34 +0000 (21:32 +0000)]
Plug various resources leak
While here fix a test logic

Reported by: coverity
CID: 1332096133209713320981332099133210013321011332102
MFC after: 1 week

8 years agoPrefer sizeof(*pointer) over sizeof(type). No funtional change.
Jung-uk Kim [Wed, 20 Apr 2016 21:30:56 +0000 (21:30 +0000)]
Prefer sizeof(*pointer) over sizeof(type).  No funtional change.

8 years agoThere is no need to use array any more. No functional change.
Jung-uk Kim [Wed, 20 Apr 2016 21:26:59 +0000 (21:26 +0000)]
There is no need to use array any more.  No functional change.

8 years agoPlug memory leaks
Baptiste Daroussin [Wed, 20 Apr 2016 21:23:42 +0000 (21:23 +0000)]
Plug memory leaks

Reported by: Coverity
CID= 13385351338536133854213385691338570

8 years agoRemove query flag from acpi_EvaluateOSC(). This function does not support
Jung-uk Kim [Wed, 20 Apr 2016 21:21:47 +0000 (21:21 +0000)]
Remove query flag from acpi_EvaluateOSC().  This function does not support
return buffer (yet).

8 years agonet80211: hide subtype mask & shift in function call.
Andriy Voskoboinyk [Wed, 20 Apr 2016 21:15:55 +0000 (21:15 +0000)]
net80211: hide subtype mask & shift in function call.

Hide subtype mask/shift (which is used for index calculation
in ieee80211_mgt_subtype_name[] array) in function call.

Tested with RTL8188CUS, STA mode.

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

8 years agoRemove unused SMB_DIALECT_MAX macro.
Pedro F. Giffuni [Wed, 20 Apr 2016 21:13:24 +0000 (21:13 +0000)]
Remove unused SMB_DIALECT_MAX macro.

Found by: jhb

8 years agoPlug leaks
Baptiste Daroussin [Wed, 20 Apr 2016 21:11:49 +0000 (21:11 +0000)]
Plug leaks

Reported by: Coverity
CID: 1340155 and 1340156
MFC after: 1 week

8 years agoAdd more fields from struct ifnet needed during debugging a kernel panic.
Bjoern A. Zeeb [Wed, 20 Apr 2016 21:04:39 +0000 (21:04 +0000)]
Add more fields from struct ifnet needed during debugging a kernel panic.
Move if_fib into the right place.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

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