svn commit: r299718 - head/sys/dev/sfxge/common

2016-05-13 Thread Andrew Rybchenko
Author: arybchik
Date: Sat May 14 05:59:18 2016
New Revision: 299718
URL: https://svnweb.freebsd.org/changeset/base/299718

Log:
  sfxge(4): rename falconsiena_filter types
  
  Falcon support has been removed, so this code only supports Siena.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D6342

Modified:
  head/sys/dev/sfxge/common/efx_filter.c
  head/sys/dev/sfxge/common/efx_impl.h

Modified: head/sys/dev/sfxge/common/efx_filter.c
==
--- head/sys/dev/sfxge/common/efx_filter.c  Sat May 14 05:27:07 2016
(r299717)
+++ head/sys/dev/sfxge/common/efx_filter.c  Sat May 14 05:59:18 2016
(r299718)
@@ -429,7 +429,7 @@ efx_filter_spec_set_mc_def(
 
 static __checkReturn   efx_rc_t
 siena_filter_spec_from_gen_spec(
-   __out   falconsiena_filter_spec_t *fs_spec,
+   __out   siena_filter_spec_t *sf_spec,
__inefx_filter_spec_t *gen_spec)
 {
efx_rc_t rc;
@@ -447,8 +447,8 @@ siena_filter_spec_from_gen_spec(
goto fail1;
}
 
-   fs_spec->fsfs_flags = gen_spec->efs_flags;
-   fs_spec->fsfs_dmaq_id = gen_spec->efs_dmaq_id;
+   sf_spec->sfs_flags = gen_spec->efs_flags;
+   sf_spec->sfs_dmaq_id = gen_spec->efs_dmaq_id;
 
switch (gen_spec->efs_match_flags) {
case EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO |
@@ -473,24 +473,24 @@ siena_filter_spec_from_gen_spec(
switch (gen_spec->efs_ip_proto) {
case EFX_IPPROTO_TCP:
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
-   fs_spec->fsfs_type = (is_full ?
-   EFX_FS_FILTER_TX_TCP_FULL :
-   EFX_FS_FILTER_TX_TCP_WILD);
+   sf_spec->sfs_type = (is_full ?
+   EFX_SIENA_FILTER_TX_TCP_FULL :
+   EFX_SIENA_FILTER_TX_TCP_WILD);
} else {
-   fs_spec->fsfs_type = (is_full ?
-   EFX_FS_FILTER_RX_TCP_FULL :
-   EFX_FS_FILTER_RX_TCP_WILD);
+   sf_spec->sfs_type = (is_full ?
+   EFX_SIENA_FILTER_RX_TCP_FULL :
+   EFX_SIENA_FILTER_RX_TCP_WILD);
}
break;
case EFX_IPPROTO_UDP:
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
-   fs_spec->fsfs_type = (is_full ?
-   EFX_FS_FILTER_TX_UDP_FULL :
-   EFX_FS_FILTER_TX_UDP_WILD);
+   sf_spec->sfs_type = (is_full ?
+   EFX_SIENA_FILTER_TX_UDP_FULL :
+   EFX_SIENA_FILTER_TX_UDP_WILD);
} else {
-   fs_spec->fsfs_type = (is_full ?
-   EFX_FS_FILTER_RX_UDP_FULL :
-   EFX_FS_FILTER_RX_UDP_WILD);
+   sf_spec->sfs_type = (is_full ?
+   EFX_SIENA_FILTER_RX_UDP_FULL :
+   EFX_SIENA_FILTER_RX_UDP_WILD);
}
break;
default:
@@ -513,7 +513,8 @@ siena_filter_spec_from_gen_spec(
host2 = gen_spec->efs_loc_host.eo_u32[0];
}
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
-   if (fs_spec->fsfs_type == EFX_FS_FILTER_TX_UDP_WILD) {
+   if (sf_spec->sfs_type ==
+   EFX_SIENA_FILTER_TX_UDP_WILD) {
port1 = rport;
port2 = gen_spec->efs_loc_port;
} else {
@@ -521,7 +522,8 @@ siena_filter_spec_from_gen_spec(
port2 = rport;
}
} else {
-   if (fs_spec->fsfs_type == EFX_FS_FILTER_RX_UDP_WILD) {
+   if (sf_spec->sfs_type ==
+   EFX_SIENA_FILTER_RX_UDP_WILD) {
port1 = gen_spec->efs_loc_port;
port2 = rport;
} else {
@@ -529,9 +531,9 @@ siena_filter_spec_from_gen_spec(
port2 = gen_spec->efs_loc_port;
}
}
-   fs_spec->fsfs_dword[0] = (host1 << 16) | port1;
-   fs_spec->fsfs_dword[1] = (port2 << 16) | (host1 >> 16);
-   fs_spec->fsfs_dword[2] = host2;
+ 

svn commit: r299717 - vendor/file/5.27

2016-05-13 Thread Xin LI
Author: delphij
Date: Sat May 14 05:27:07 2016
New Revision: 299717
URL: https://svnweb.freebsd.org/changeset/base/299717

Log:
  Tag file 5.27.

Added:
  vendor/file/5.27/
 - copied from r299716, vendor/file/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299716 - in vendor/file/dist: . magic/Magdir src tests

2016-05-13 Thread Xin LI
Author: delphij
Date: Sat May 14 05:25:47 2016
New Revision: 299716
URL: https://svnweb.freebsd.org/changeset/base/299716

Log:
  Vendor import of file 4.27.

Modified:
  vendor/file/dist/ChangeLog
  vendor/file/dist/configure
  vendor/file/dist/configure.ac
  vendor/file/dist/magic/Magdir/archive
  vendor/file/dist/magic/Magdir/commands
  vendor/file/dist/magic/Magdir/console
  vendor/file/dist/magic/Magdir/os2
  vendor/file/dist/magic/Magdir/xenix
  vendor/file/dist/src/ascmagic.c
  vendor/file/dist/src/cdf.c
  vendor/file/dist/src/cdf.h
  vendor/file/dist/src/compress.c
  vendor/file/dist/src/der.c
  vendor/file/dist/src/magic.c
  vendor/file/dist/src/magic.h
  vendor/file/dist/src/magic.h.in
  vendor/file/dist/src/readcdf.c
  vendor/file/dist/src/softmagic.c
  vendor/file/dist/tests/Makefile.am
  vendor/file/dist/tests/Makefile.in

Modified: vendor/file/dist/ChangeLog
==
--- vendor/file/dist/ChangeLog  Sat May 14 05:00:17 2016(r299715)
+++ vendor/file/dist/ChangeLog  Sat May 14 05:25:47 2016(r299716)
@@ -1,6 +1,19 @@
+2016-05-13  12:00  Christos Zoulas 
+   
+   * release 5.27
+
+2016-04-18   9:35  Christos Zoulas 
+   
+   * Errors comparing DER entries or computing offsets
+ are just indications of malformed non-DER files.
+ Don't print them.
+   * Offset comparison was off-by-one.
+   * Fix compression code (Werner Fink)
+   * Put new bytes constant in the right file (not the generated one)
+
 2016-04-16  18:34  Christos Zoulas 

-   * release 5.25
+   * release 5.26
 
 2016-03-31  13:50  Christos Zoulas 
 

Modified: vendor/file/dist/configure
==
--- vendor/file/dist/configure  Sat May 14 05:00:17 2016(r299715)
+++ vendor/file/dist/configure  Sat May 14 05:25:47 2016(r299716)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for file 5.26.
+# Generated by GNU Autoconf 2.69 for file 5.27.
 #
 # Report bugs to .
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='file'
 PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.26'
-PACKAGE_STRING='file 5.26'
+PACKAGE_VERSION='5.27'
+PACKAGE_STRING='file 5.27'
 PACKAGE_BUGREPORT='chris...@astron.com'
 PACKAGE_URL=''
 
@@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures file 5.26 to adapt to many kinds of systems.
+\`configure' configures file 5.27 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1397,7 +1397,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of file 5.26:";;
+ short | recursive ) echo "Configuration of file 5.27:";;
esac
   cat <<\_ACEOF
 
@@ -1507,7 +1507,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-file configure 5.26
+file configure 5.27
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by file $as_me 5.26, which was
+It was created by file $as_me 5.27, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3029,7 +3029,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='file'
- VERSION='5.26'
+ VERSION='5.27'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -15049,7 +15049,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by file $as_me 5.26, which was
+This file was extended by file $as_me 5.27, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -15115,7 +15115,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/&/g'`"
 ac_cs_version="\\
-file config.status 5.26
+file config.status 5.27
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: vendor/file/dist/configure.ac
==
--- vendor/file/dist/configure.ac   Sat May 14 05:00:17 2016
(r299715)
+++ vendor/file/dist/configure.ac   Sat May 14 05:25:47 2016
(r299716)
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure 

svn commit: r299715 - in head/sys/arm/nvidia: . tegra124

2016-05-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat May 14 05:00:17 2016
New Revision: 299715
URL: https://svnweb.freebsd.org/changeset/base/299715

Log:
  Use OF_prop_free instead of direct call to free(9)
  
  Reviewed by:  mmel@

Modified:
  head/sys/arm/nvidia/as3722_gpio.c
  head/sys/arm/nvidia/tegra124/tegra124_coretemp.c
  head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c
  head/sys/arm/nvidia/tegra_pinmux.c
  head/sys/arm/nvidia/tegra_usbphy.c

Modified: head/sys/arm/nvidia/as3722_gpio.c
==
--- head/sys/arm/nvidia/as3722_gpio.c   Sat May 14 04:59:36 2016
(r299714)
+++ head/sys/arm/nvidia/as3722_gpio.c   Sat May 14 05:00:17 2016
(r299715)
@@ -254,9 +254,9 @@ as3722_pinmux_process_node(struct as3722
} while (len < lpins);
 
if (pins != NULL)
-   free(pins, M_OFWPROP);
+   OF_prop_free(pins);
if (cfg.function != NULL)
-   free(cfg.function, M_OFWPROP);
+   OF_prop_free(cfg.function);
 
return (rv);
 }

Modified: head/sys/arm/nvidia/tegra124/tegra124_coretemp.c
==
--- head/sys/arm/nvidia/tegra124/tegra124_coretemp.cSat May 14 04:59:36 
2016(r299714)
+++ head/sys/arm/nvidia/tegra124/tegra124_coretemp.cSat May 14 05:00:17 
2016(r299715)
@@ -164,7 +164,7 @@ tegra124_coretemp_ofw_parse(struct tegra
}
 
sc->tsens_id = 0x100 + sc->cpu_id; //cells[0];
-   free(cells, M_OFWPROP);
+   OF_prop_free(cells);
 
sc->tsens_dev = OF_device_from_xref(xnode);
if (sc->tsens_dev == NULL) {

Modified: head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c
==
--- head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c  Sat May 14 04:59:36 
2016(r299714)
+++ head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c  Sat May 14 05:00:17 
2016(r299715)
@@ -274,9 +274,9 @@ xusbpadctl_process_node(struct xusbpadct
} while (len < llanes);
 
if (lanes != NULL)
-   free(lanes, M_OFWPROP);
+   OF_prop_free(lanes);
if (cfg.function != NULL)
-   free(cfg.function, M_OFWPROP);
+   OF_prop_free(cfg.function);
return (rv);
 }
 

Modified: head/sys/arm/nvidia/tegra_pinmux.c
==
--- head/sys/arm/nvidia/tegra_pinmux.c  Sat May 14 04:59:36 2016
(r299714)
+++ head/sys/arm/nvidia/tegra_pinmux.c  Sat May 14 05:00:17 2016
(r299715)
@@ -693,9 +693,9 @@ pinmux_process_node(struct pinmux_softc 
} while (len < lpins);
 
if (pins != NULL)
-   free(pins, M_OFWPROP);
+   OF_prop_free(pins);
if (cfg.function != NULL)
-   free(cfg.function, M_OFWPROP);
+   OF_prop_free(cfg.function);
return (rv);
 }
 

Modified: head/sys/arm/nvidia/tegra_usbphy.c
==
--- head/sys/arm/nvidia/tegra_usbphy.c  Sat May 14 04:59:36 2016
(r299714)
+++ head/sys/arm/nvidia/tegra_usbphy.c  Sat May 14 05:00:17 2016
(r299715)
@@ -593,7 +593,7 @@ usb_get_ifc_mode(device_t dev, phandle_t
ret = USB_IFC_TYPE_ULPI;
else
device_printf(dev, "Unsupported phy type: %s\n", tmpstr);
-   free(tmpstr, M_OFWPROP);
+   OF_prop_free(tmpstr);
return (ret);
 }
 
@@ -617,7 +617,7 @@ usb_get_dr_mode(device_t dev, phandle_t 
ret = USB_DR_MODE_OTG;
else
device_printf(dev, "Unknown dr mode: %s\n", tmpstr);
-   free(tmpstr, M_OFWPROP);
+   OF_prop_free(tmpstr);
return (ret);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299714 - in head/sys/dev/extres: clk hwreset phy regulator

2016-05-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat May 14 04:59:36 2016
New Revision: 299714
URL: https://svnweb.freebsd.org/changeset/base/299714

Log:
  Use OF_prop_free instead of direct call to free(9)
  
  Reviewed by:  mmel@

Modified:
  head/sys/dev/extres/clk/clk.c
  head/sys/dev/extres/clk/clk_fixed.c
  head/sys/dev/extres/hwreset/hwreset.c
  head/sys/dev/extres/phy/phy.c
  head/sys/dev/extres/regulator/regulator.c

Modified: head/sys/dev/extres/clk/clk.c
==
--- head/sys/dev/extres/clk/clk.c   Sat May 14 04:29:13 2016
(r299713)
+++ head/sys/dev/extres/clk/clk.c   Sat May 14 04:59:36 2016
(r299714)
@@ -1241,7 +1241,7 @@ clk_get_by_ofw_index(device_t dev, int i
 
 done:
if (cells != NULL)
-   free(cells, M_OFWPROP);
+   OF_prop_free(cells);
return (rv);
 }
 
@@ -1297,8 +1297,8 @@ clk_parse_ofw_out_names(device_t dev, ph
if (rv != name_items) {
device_printf(dev, " Size of 'clock-output-names' and "
"'clock-indices' differs\n");
-   free(*out_names, M_OFWPROP);
-   free(*indices, M_OFWPROP);
+   OF_prop_free(*out_names);
+   OF_prop_free(*indices);
return (0);
}
return (name_items);
@@ -1325,12 +1325,12 @@ clk_parse_ofw_clk_name(device_t dev, pha
rv = ofw_bus_string_list_to_array(node, "clock-output-names",
_names);
if (rv != 1) {
-   free(out_names, M_OFWPROP);
+   OF_prop_free(out_names);
device_printf(dev, "Malformed 'clock-output-names' property\n");
return (ENXIO);
}
*name = strdup(out_names[0], M_OFWPROP);
-   free(out_names, M_OFWPROP);
+   OF_prop_free(out_names);
return (0);
 }
 #endif

Modified: head/sys/dev/extres/clk/clk_fixed.c
==
--- head/sys/dev/extres/clk/clk_fixed.c Sat May 14 04:29:13 2016
(r299713)
+++ head/sys/dev/extres/clk/clk_fixed.c Sat May 14 04:59:36 2016
(r299714)
@@ -254,13 +254,13 @@ clk_fixed_attach(device_t dev)
 #ifdef CLK_DEBUG
clkdom_dump(sc->clkdom);
 #endif
-   free(__DECONST(char *, def.clkdef.name), M_OFWPROP);
-   free(def.clkdef.parent_names, M_OFWPROP);
+   OF_prop_free(__DECONST(char *, def.clkdef.name));
+   OF_prop_free(def.clkdef.parent_names);
return (bus_generic_attach(dev));
 
 fail:
-   free(__DECONST(char *, def.clkdef.name), M_OFWPROP);
-   free(def.clkdef.parent_names, M_OFWPROP);
+   OF_prop_free(__DECONST(char *, def.clkdef.name));
+   OF_prop_free(def.clkdef.parent_names);
return (rv);
 }
 

Modified: head/sys/dev/extres/hwreset/hwreset.c
==
--- head/sys/dev/extres/hwreset/hwreset.c   Sat May 14 04:29:13 2016
(r299713)
+++ head/sys/dev/extres/hwreset/hwreset.c   Sat May 14 04:59:36 2016
(r299714)
@@ -132,12 +132,12 @@ hwreset_get_by_ofw_idx(device_t consumer
/* Tranlate provider to device */
rstdev = OF_device_from_xref(xnode);
if (rstdev == NULL) {
-   free(cells, M_OFWPROP);
+   OF_prop_free(cells);
return (ENODEV);
}
/* Map reset to number */
rv = HWRESET_MAP(rstdev, xnode, ncells, cells, );
-   free(cells, M_OFWPROP);
+   OF_prop_free(cells);
if (rv != 0)
return (rv);
 

Modified: head/sys/dev/extres/phy/phy.c
==
--- head/sys/dev/extres/phy/phy.c   Sat May 14 04:29:13 2016
(r299713)
+++ head/sys/dev/extres/phy/phy.c   Sat May 14 04:59:36 2016
(r299714)
@@ -146,12 +146,12 @@ phy_get_by_ofw_idx(device_t consumer_dev
/* Tranlate provider to device. */
phydev = OF_device_from_xref(xnode);
if (phydev == NULL) {
-   free(cells, M_OFWPROP);
+   OF_prop_free(cells);
return (ENODEV);
}
/* Map phy to number. */
rv = PHY_MAP(phydev, xnode, ncells, cells, );
-   free(cells, M_OFWPROP);
+   OF_prop_free(cells);
if (rv != 0)
return (rv);
 
@@ -199,12 +199,12 @@ phy_get_by_ofw_property(device_t consume
/* Tranlate provider to device. */
phydev = OF_device_from_xref(cells[0]);
if (phydev == NULL) {
-   free(cells, M_OFWPROP);
+   OF_prop_free(cells);
return (ENODEV);
}
/* Map phy to number. */
rv = PHY_MAP(phydev, cells[0], ncells - 1 , cells + 1, );
-   free(cells, M_OFWPROP);
+   OF_prop_free(cells);
if (rv != 0)
return (rv);
 

Modified: head/sys/dev/extres/regulator/regulator.c

svn commit: r299713 - head/usr.sbin/timed/timed

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 14 04:29:13 2016
New Revision: 299713
URL: https://svnweb.freebsd.org/changeset/base/299713

Log:
  Undo the bogus gethostname() change from r299709.
  
  The "- 1" is there specifically to enable checking for NUL termination.
  
  I should also admit the rest change was mostly cosmetic and the
  overruns can't occur in practice: still I leave them to pacify
  static analyzers.
  
  Pointed out by:   bde

Modified:
  head/usr.sbin/timed/timed/timed.c

Modified: head/usr.sbin/timed/timed/timed.c
==
--- head/usr.sbin/timed/timed/timed.c   Sat May 14 04:13:28 2016
(r299712)
+++ head/usr.sbin/timed/timed/timed.c   Sat May 14 04:29:13 2016
(r299713)
@@ -196,7 +196,7 @@ main(int argc, char *argv[])
if (goodgroup != NULL || goodhosts != NULL)
Mflag = 1;
 
-   if (gethostname(hostname, sizeof(hostname)) < 0)
+   if (gethostname(hostname, sizeof(hostname) - 1) < 0)
err(1, "gethostname");
self.l_bak = 
self.l_fwd = 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299712 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Sat May 14 04:13:28 2016
New Revision: 299712
URL: https://svnweb.freebsd.org/changeset/base/299712

Log:
  Fix some trivial clang/gcc warnings in bsnmptc.c
  
  - By definition, `enum snmp_tc` can't be false (the implied starting sequence
index for the enum is 0). Don't test for it being < 0.
  - Staticize `struct snmp_text_conv` to mute a -Wmissing-variable-declarations
warning from clang.
  - Remove set but unused variable, ptr, in parse_bridge_id(..) and
parse_bport_id(..) to mute warning from gcc 4.9+.
  - Mark value and string unused in snmp_inetaddr2oct(..) and parse_inetaddr(..)
as they're just stub functions.
  
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c  Sat May 14 04:00:17 
2016(r299711)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c  Sat May 14 04:13:28 
2016(r299712)
@@ -93,7 +93,7 @@ static char *snmp_oct2bits(uint32_t len,
 static char *snmp_bits2oct(char *str, struct asn_oid *oid);
 static int32_t parse_bits(struct snmp_value *value, char *string);
 
-struct snmp_text_conv {
+static struct snmp_text_conv {
enum snmp_tctc;
const char  *tc_str;
int32_t len;
@@ -158,7 +158,7 @@ snmp_oct2tc(enum snmp_tc tc, uint32_t le
uint32_t tc_len;
char * buf;
 
-   if (tc < 0 || tc > SNMP_UNKNOWN)
+   if (tc > SNMP_UNKNOWN)
tc = SNMP_UNKNOWN;
 
if (text_convs[tc].len > 0)
@@ -183,7 +183,7 @@ snmp_oct2tc(enum snmp_tc tc, uint32_t le
 char *
 snmp_tc2oid(enum snmp_tc tc, char *str, struct asn_oid *oid)
 {
-   if (tc < 0 || tc > SNMP_UNKNOWN)
+   if (tc > SNMP_UNKNOWN)
tc = SNMP_UNKNOWN;
 
return (text_convs[tc].tc2oid(str, oid));
@@ -192,7 +192,7 @@ snmp_tc2oid(enum snmp_tc tc, char *str, 
 int32_t
 snmp_tc2oct(enum snmp_tc tc, struct snmp_value *value, char *string)
 {
-   if (tc < 0 || tc > SNMP_UNKNOWN)
+   if (tc > SNMP_UNKNOWN)
tc = SNMP_UNKNOWN;
 
return (text_convs[tc].tc2oct(value, string));
@@ -929,12 +929,11 @@ snmp_bridgeid2oct(char *str, struct asn_
 static int32_t
 parse_bridge_id(struct snmp_value *sv, char *string)
 {
-   char *ptr, *endptr;
+   char *endptr;
int32_t i, saved_errno;
uint32_t v;
uint8_t bridge_id[SNMP_BRIDGEID_OCTETS];
 
-   ptr = string;
/* Read the priority. */
saved_errno = errno;
errno = 0;
@@ -1057,12 +1056,11 @@ snmp_bport_id2oct(char *str, struct asn_
 static int32_t
 parse_bport_id(struct snmp_value *value, char *string)
 {
-   char *ptr, *endptr;
+   char *endptr;
int saved_errno;
uint32_t v;
uint8_t bport_id[SNMP_BPORT_OCTETS];
 
-   ptr = string;
/* Read the priority. */
saved_errno = errno;
errno = 0;
@@ -1175,13 +1173,13 @@ snmp_oct2inetaddr(uint32_t len, char *oc
 }
 
 static char *
-snmp_inetaddr2oct(char *str, struct asn_oid *oid)
+snmp_inetaddr2oct(char *str __unused, struct asn_oid *oid __unused)
 {
return (NULL);
 }
 
 static int32_t
-parse_inetaddr(struct snmp_value *value, char *string)
+parse_inetaddr(struct snmp_value *value __unused, char *string __unused)
 {
return (-1);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299709 - head/usr.sbin/timed/timed

2016-05-13 Thread Bruce Evans

On Sat, 14 May 2016, Pedro F. Giffuni wrote:


Log:
 timed(8): Use strlcpy() for bounds checking.

 Prevent some theorical buffer overruns reported by Coverity.
 Cleanup a use of gethostname() while here.

 CID:   1006713, 1011166, 1011167, 1011168,


This has minor unimprovements except it breaks the error checking for
gethostname().

...
Modified: head/usr.sbin/timed/timed/timed.c
==
--- head/usr.sbin/timed/timed/timed.c   Sat May 14 01:12:23 2016
(r299708)
+++ head/usr.sbin/timed/timed/timed.c   Sat May 14 02:42:09 2016
(r299709)
@@ -196,7 +196,7 @@ main(int argc, char *argv[])
if (goodgroup != NULL || goodhosts != NULL)
Mflag = 1;

-   if (gethostname(hostname, sizeof(hostname) - 1) < 0)
+   if (gethostname(hostname, sizeof(hostname)) < 0)
err(1, "gethostname");
self.l_bak = 
self.l_fwd = 


gethostname() returns a non-NUL terminated buffer with no error if the
non-terminated array fits exactly.

The old code carefully arranges for NUL termination if the system's
hostname has length sizeof(hostname) - 1 (although the syscall doesn't
give termination) and an error if the system's hostname has length
sizeof(hostname).

The new code gives a non-NUL-terminated buffer if the system's
hostname has length sizeof(hostname).  Buffer overruns soon occur in
code that expects the hostname variable to be a string.

The overrun probably can't occur in practice, since the hostname variable
has the current maximum size, unless someone enlarges {HOST_NAME_MAX}.
Enlarging it would break old applications that use MAXHOSTNAMELEN instead
of {HOST_NAME_MAX} and have buggy error handling.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299711 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Sat May 14 04:00:17 2016
New Revision: 299711
URL: https://svnweb.freebsd.org/changeset/base/299711

Log:
  Fold two malloc + memset(.., 0, ..) calls into equivalent calloc calls
  
  MFC after: 3 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c  Sat May 14 
03:57:18 2016(r299710)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c  Sat May 14 
04:00:17 2016(r299711)
@@ -635,12 +635,11 @@ snmp_import_table(struct snmp_toolinfo *
enum tok tok;
struct snmp_index_entry *entry;
 
-   if ((entry = malloc(sizeof(struct snmp_index_entry))) == NULL) {
+   if ((entry = calloc(1, sizeof(struct snmp_index_entry))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (-1);
}
 
-   memset(entry, 0, sizeof(struct snmp_index_entry));
STAILQ_INIT(&(entry->index_list));
 
for (i = 0, tok = gettoken(snmptoolctx); i < SNMP_INDEXES_MAX; i++) {
@@ -764,7 +763,7 @@ snmp_import_object(struct snmp_toolinfo 
if (snmp_import_head(snmptoolctx) < 0)
return (-1);
 
-   if ((oid2str = malloc(sizeof(struct snmp_oid2str))) == NULL) {
+   if ((oid2str = calloc(1, sizeof(struct snmp_oid2str))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (-1);
}
@@ -775,7 +774,6 @@ snmp_import_object(struct snmp_toolinfo 
return (-1);
}
 
-   memset(oid2str, 0, sizeof(struct snmp_oid2str));
strlcpy(string, nexttok, strlen(nexttok) + 1);
oid2str->string = string;
oid2str->strlen = strlen(nexttok);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299710 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Sat May 14 03:57:18 2016
New Revision: 299710
URL: https://svnweb.freebsd.org/changeset/base/299710

Log:
  Staticize global variables only used in bsnmpimport.c to fix
  -Wmissing-variable-declarations warnings
  
  MFC after: 3 weeks
  Reported by: clang
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c  Sat May 14 
02:42:09 2016(r299709)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c  Sat May 14 
03:57:18 2016(r299710)
@@ -140,9 +140,9 @@ struct input {
LIST_ENTRY(input) link;
 };
 
-LIST_HEAD(, input) inputs = LIST_HEAD_INITIALIZER(inputs);
-struct input *input = NULL;
-int32_t pbchar = -1;
+static LIST_HEAD(, input) inputs = LIST_HEAD_INITIALIZER(inputs);
+static struct input *input = NULL;
+static int32_t pbchar = -1;
 
 #defineMAX_PATHS   100
 
@@ -301,18 +301,18 @@ static const struct {
{ NULL, 0, 0 }
 };
 
-struct {
+static struct {
/* Current OID type, regarding table membership. */
enum snmp_tbl_entry tbl_type;
/* A pointer to a structure in table list to add to its members. */
struct snmp_index_entry *table_idx;
 } table_data;
 
-struct asn_oid current_oid;
-char nexttok[MAXSTR];
-u_long val;/* integer values */
-int32_tall_cond;   /* all conditions are true */
-int32_t saved_token = -1;
+static struct asn_oid current_oid;
+static char nexttok[MAXSTR];
+static u_long val; /* integer values */
+static int32_t all_cond;   /* all conditions are true */
+static int32_t saved_token = -1;
 
 /* Prepare the global data before parsing a new file. */
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299709 - head/usr.sbin/timed/timed

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 14 02:42:09 2016
New Revision: 299709
URL: https://svnweb.freebsd.org/changeset/base/299709

Log:
  timed(8): Use strlcpy() for bounds checking.
  
  Prevent some theorical buffer overruns reported by Coverity.
  Cleanup a use of gethostname() while here.
  
  CID:  1006713, 1011166, 1011167, 1011168,

Modified:
  head/usr.sbin/timed/timed/master.c
  head/usr.sbin/timed/timed/slave.c
  head/usr.sbin/timed/timed/timed.c

Modified: head/usr.sbin/timed/timed/master.c
==
--- head/usr.sbin/timed/timed/master.c  Sat May 14 01:12:23 2016
(r299708)
+++ head/usr.sbin/timed/timed/master.c  Sat May 14 02:42:09 2016
(r299709)
@@ -165,7 +165,8 @@ loop:
 * XXX check to see it is from ourself
 */
tsp_time_sec = msg->tsp_time.tv_sec;
-   (void)strcpy(newdate, ctime(_time_sec));
+   (void)strlcpy(newdate, ctime(_time_sec),
+   sizeof(newdate));
if (!good_host_name(msg->tsp_name)) {
syslog(LOG_NOTICE,
   "attempted date change by %s to %s",
@@ -183,7 +184,8 @@ loop:
if (!fromnet || fromnet->status != MASTER)
break;
tsp_time_sec = msg->tsp_time.tv_sec;
-   (void)strcpy(newdate, ctime(_time_sec));
+   (void)strlcpy(newdate, ctime(_time_sec),
+   sizeof(newdate));
htp = findhost(msg->tsp_name);
if (htp == NULL) {
syslog(LOG_ERR,
@@ -350,7 +352,7 @@ mchgdate(struct tsp *msg)
 
xmit(TSP_DATEACK, msg->tsp_seq, );
 
-   (void)strcpy(olddate, date());
+   (void)strlcpy(olddate, date(), sizeof(olddate));
 
/* adjust time for residence on the queue */
(void)gettimeofday(, NULL);

Modified: head/usr.sbin/timed/timed/slave.c
==
--- head/usr.sbin/timed/timed/slave.c   Sat May 14 01:12:23 2016
(r299708)
+++ head/usr.sbin/timed/timed/slave.c   Sat May 14 02:42:09 2016
(r299709)
@@ -254,9 +254,10 @@ loop:
 * the following line is necessary due to syslog
 * calling ctime() which clobbers the static buffer
 */
-   (void)strcpy(olddate, date());
+   (void)strlcpy(olddate, date(), sizeof(olddate));
tsp_time_sec = msg->tsp_time.tv_sec;
-   (void)strcpy(newdate, ctime(_time_sec));
+   (void)strlcpy(newdate, ctime(_time_sec),
+   sizeof(newdate));
 
if (!good_host_name(msg->tsp_name)) {
syslog(LOG_NOTICE,
@@ -342,7 +343,8 @@ loop:
 
case TSP_SETDATE:
tsp_time_sec = msg->tsp_time.tv_sec;
-   (void)strcpy(newdate, ctime(_time_sec));
+   (void)strlcpy(newdate, ctime(_time_sec),
+   sizeof(newdate));
schgdate(msg, newdate);
break;
 
@@ -350,7 +352,8 @@ loop:
if (fromnet->status != MASTER)
break;
tsp_time_sec = msg->tsp_time.tv_sec;
-   (void)strcpy(newdate, ctime(_time_sec));
+   (void)strlcpy(newdate, ctime(_time_sec),
+   sizeof(newdate));
htp = findhost(msg->tsp_name);
if (htp == NULL) {
syslog(LOG_WARNING,

Modified: head/usr.sbin/timed/timed/timed.c
==
--- head/usr.sbin/timed/timed/timed.c   Sat May 14 01:12:23 2016
(r299708)
+++ head/usr.sbin/timed/timed/timed.c   Sat May 14 02:42:09 2016
(r299709)
@@ -196,7 +196,7 @@ main(int argc, char *argv[])
if (goodgroup != NULL || goodhosts != NULL)
Mflag = 1;
 
-   if (gethostname(hostname, sizeof(hostname) - 1) < 0)
+   if (gethostname(hostname, sizeof(hostname)) < 0)
err(1, "gethostname");
self.l_bak = 
self.l_fwd = 
@@ -455,7 +455,7 @@ suppress(struct sockaddr_in *addr, char 
if (trace)
fprintf(fd, "suppress: %s\n", name);
tgt = *addr;
-   (void)strcpy(tname, name);
+   (void)strlcpy(tname, name, sizeof(tname));
 
while (0 != readmsg(TSP_ANY, ANYADDR, , net)) {
if (trace)
___
svn-src-all@freebsd.org mailing list

svn commit: r299708 - head/usr.sbin/timed/timed

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 14 01:12:23 2016
New Revision: 299708
URL: https://svnweb.freebsd.org/changeset/base/299708

Log:
  timed(8): Use stronger random number generator.
  
  Using arc4random simplifies the code by not having to worry about
  seeds which ironically depend on the time.
  
  CID:  134

Modified:
  head/usr.sbin/timed/timed/timed.c

Modified: head/usr.sbin/timed/timed/timed.c
==
--- head/usr.sbin/timed/timed/timed.c   Sat May 14 00:46:38 2016
(r299707)
+++ head/usr.sbin/timed/timed/timed.c   Sat May 14 01:12:23 2016
(r299708)
@@ -229,12 +229,9 @@ main(int argc, char *argv[])
exit(1);
}
 
-   /* choose a unique seed for random number generation */
-   (void)gettimeofday(, NULL);
-   srandom(ntime.tv_sec + ntime.tv_usec);
-
-   sequence = random(); /* initial seq number */
+   sequence = arc4random(); /* initial seq number */
 
+   (void)gettimeofday(, NULL);
/* rounds kernel variable time to multiple of 5 ms. */
ntime.tv_sec = 0;
ntime.tv_usec = -((ntime.tv_usec/1000) % 5) * 1000;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299707 - in head/usr.sbin/timed: timed timedc

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 14 00:46:38 2016
New Revision: 299707
URL: https://svnweb.freebsd.org/changeset/base/299707

Log:
  timed(8): use NULL instead of zero for pointers.

Modified:
  head/usr.sbin/timed/timed/acksend.c
  head/usr.sbin/timed/timed/master.c
  head/usr.sbin/timed/timed/readmsg.c
  head/usr.sbin/timed/timed/slave.c
  head/usr.sbin/timed/timed/timed.c
  head/usr.sbin/timed/timedc/cmds.c
  head/usr.sbin/timed/timedc/timedc.c

Modified: head/usr.sbin/timed/timed/acksend.c
==
--- head/usr.sbin/timed/timed/acksend.c Sat May 14 00:44:23 2016
(r299706)
+++ head/usr.sbin/timed/timed/acksend.c Sat May 14 00:46:38 2016
(r299707)
@@ -90,7 +90,7 @@ acksend(struct tsp *message, struct sock
 
msec = 200;
count = bad ? 1 : 5;/* 5 packets in 6.4 seconds */
-   answer = 0;
+   answer = NULL;
do {
if (!answer) {
/* do not go crazy transmitting just because the
@@ -107,7 +107,7 @@ acksend(struct tsp *message, struct sock
 
mstotvround(, msec);
answer  = readmsg(ack, name, , net);
-   if (answer != 0) {
+   if (answer != NULL) {
if (answer->tsp_seq != sequence) {
if (trace)
fprintf(fd,"acksend: seq # %u!=%u\n",

Modified: head/usr.sbin/timed/timed/master.c
==
--- head/usr.sbin/timed/timed/master.c  Sat May 14 00:44:23 2016
(r299706)
+++ head/usr.sbin/timed/timed/master.c  Sat May 14 00:46:38 2016
(r299707)
@@ -185,7 +185,7 @@ loop:
tsp_time_sec = msg->tsp_time.tv_sec;
(void)strcpy(newdate, ctime(_time_sec));
htp = findhost(msg->tsp_name);
-   if (htp == 0) {
+   if (htp == NULL) {
syslog(LOG_ERR,
   "attempted SET DATEREQ by uncontrolled 
%s to %s",
   msg->tsp_name, newdate);
@@ -477,7 +477,7 @@ spreadtime(void)
to.tsp_time.tv_usec = tmptv.tv_usec;
answer = acksend(, >addr, htp->name,
 TSP_ACK, 0, htp->noanswer);
-   if (answer == 0) {
+   if (answer == NULL) {
/* We client does not respond, then we have
 * just wasted lots of time on it.
 */
@@ -566,7 +566,7 @@ addmach(char *name, struct sockaddr_in *
struct hosttbl *ret, *p, *b, *f;
 
ret = findhost(name);
-   if (ret == 0) {
+   if (ret == NULL) {
if (slvcount >= NHOSTS) {
if (trace) {
fprintf(fd, "no more slots in host table\n");
@@ -684,8 +684,8 @@ remmach(struct hosttbl *htp)
}
 
lasthfree->name[0] = '\0';
-   lasthfree->h_fwd = 0;
-   lasthfree->l_fwd = 0;
+   lasthfree->h_fwd = NULL;
+   lasthfree->l_fwd = NULL;
slvcount--;
 
return lprv;
@@ -828,7 +828,7 @@ traceoff(char *msg)
if (trace) {
fprintf(fd, msg, date());
(void)fclose(fd);
-   fd = 0;
+   fd = NULL;
}
 #ifdef GPROF
moncontrol(0);

Modified: head/usr.sbin/timed/timed/readmsg.c
==
--- head/usr.sbin/timed/timed/readmsg.c Sat May 14 00:44:23 2016
(r299706)
+++ head/usr.sbin/timed/timed/readmsg.c Sat May 14 00:46:38 2016
(r299707)
@@ -85,9 +85,9 @@ readmsg(int type, char *machfrom, struct
fprintf(fd, "readmsg: looking for %s from %s, %s\n",
tsptype[type], machfrom == NULL ? "ANY" : machfrom,
netfrom == NULL ? "ANYNET" : inet_ntoa(netfrom->net));
-   if (head->p != 0) {
+   if (head->p != NULL) {
length = 1;
-   for (ptr = head->p; ptr != 0; ptr = ptr->p) {
+   for (ptr = head->p; ptr != NULL; ptr = ptr->p) {
/* do not repeat the hundreds of messages */
if (++length > 3) {
if (ptr == tail) {

Modified: head/usr.sbin/timed/timed/slave.c
==
--- head/usr.sbin/timed/timed/slave.c   Sat May 14 00:44:23 2016
(r299706)
+++ head/usr.sbin/timed/timed/slave.c   Sat May 14 00:46:38 2016
(r299707)
@@ -78,7 +78,7 @@ slave(void)
struct utmpx utx;
 
 
-   old_slavenet = 0;
+   old_slavenet = NULL;
seq = 0;
refusetime = 0;
adjtime = 0;
@@ -352,7 

svn commit: r299706 - stable/10/sys/boot/forth

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 14 00:44:23 2016
New Revision: 299706
URL: https://svnweb.freebsd.org/changeset/base/299706

Log:
  MFC r298831:
  boot/forth: minor spelling fixes.

Modified:
  stable/10/sys/boot/forth/delay.4th
  stable/10/sys/boot/forth/loader.4th
  stable/10/sys/boot/forth/loader.conf
  stable/10/sys/boot/forth/menu.4th
  stable/10/sys/boot/forth/support.4th
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/forth/delay.4th
==
--- stable/10/sys/boot/forth/delay.4th  Sat May 14 00:35:49 2016
(r299705)
+++ stable/10/sys/boot/forth/delay.4th  Sat May 14 00:44:23 2016
(r299706)
@@ -66,7 +66,7 @@ only forth definitions also delay-proces
 
false delay_showdots ! \ reset to zero and read from environment
s" delay_showdots" getenv dup -1 <> if
-   2drop \ don't need the value, just existance
+   2drop \ don't need the value, just existence
true delay_showdots !
else
drop

Modified: stable/10/sys/boot/forth/loader.4th
==
--- stable/10/sys/boot/forth/loader.4th Sat May 14 00:35:49 2016
(r299705)
+++ stable/10/sys/boot/forth/loader.4th Sat May 14 00:44:23 2016
(r299706)
@@ -136,7 +136,7 @@ only forth definitions also support-func
 \ * start
 \
 \   Initializes support.4th global variables, sets loader_conf_files,
-\   processes conf files, and, if any one such file was succesfully
+\   processes conf files, and, if any one such file was successfully
 \   read to the end, loads kernel and modules.
 
 : start  ( -- ) ( throws: abort & user-defined )
@@ -144,7 +144,7 @@ only forth definitions also support-func
   include_conf_files
   include_nextboot_file
   \ Will *NOT* try to load kernel and modules if no configuration file
-  \ was succesfully loaded!
+  \ was successfully loaded!
   any_conf_read? if
 s" loader_delay" getenv -1 = if
   load_xen_throw

Modified: stable/10/sys/boot/forth/loader.conf
==
--- stable/10/sys/boot/forth/loader.confSat May 14 00:35:49 2016
(r299705)
+++ stable/10/sys/boot/forth/loader.confSat May 14 00:44:23 2016
(r299706)
@@ -142,7 +142,7 @@ module_path="/boot/modules" # Set the mo
 #kern.cam.boot_delay="1"   # Delay (in ms) of root mount for CAM bus
# registration, useful for USB sticks as root
 #kern.cam.scsi_delay="2000"# Delay (in ms) before probing SCSI
-#kern.ipc.maxsockets=""# Set the maximum number of sockets 
avaliable
+#kern.ipc.maxsockets=""# Set the maximum number of sockets 
available
 #kern.ipc.nmbclusters=""   # Set the number of mbuf clusters
 #kern.ipc.nsfbufs=""   # Set the number of sendfile(2) bufs
 #net.inet.tcp.tcbhashsize=""   # Set the value of TCBHASHSIZE

Modified: stable/10/sys/boot/forth/menu.4th
==
--- stable/10/sys/boot/forth/menu.4th   Sat May 14 00:35:49 2016
(r299705)
+++ stable/10/sys/boot/forth/menu.4th   Sat May 14 00:44:23 2016
(r299706)
@@ -282,7 +282,7 @@ also menu-infrastructure definitions
 ;
 
 \ This function parses $kernels into variables that are used by the menu to
-\ display wich kernel to boot when the [overloaded] `boot' word is interpreted.
+\ display which kernel to boot when the [overloaded] `boot' word is 
interpreted.
 \ Used internally by menu-create, you need not (nor should you) call this
 \ directly.
 \ 
@@ -790,7 +790,7 @@ also menu-infrastructure definitions
again
 ;
 
-: menu-erase ( -- ) \ Erases menu and resets positioning variable to positon 1.
+: menu-erase ( -- ) \ Erases menu and resets positioning variable to position 
1.
 
\ Clear the screen area associated with the interactive menu
menuX @ menuY @

Modified: stable/10/sys/boot/forth/support.4th
==
--- stable/10/sys/boot/forth/support.4thSat May 14 00:35:49 2016
(r299705)
+++ stable/10/sys/boot/forth/support.4thSat May 14 00:44:23 2016
(r299706)
@@ -56,7 +56,7 @@
 \ string conf_filesconfiguration files to be loaded
 \ cell modules_options pointer to first module information
 \ value verbose?   indicates if user wants a verbose loading
-\ value any_conf_read? indicates if a conf file was succesfully read
+\ value any_conf_read? indicates if a conf file was successfully read
 \
 \ Other exported words:
 \note, strlen is internal
@@ -960,7 +960,7 @@ only forth also support-functions defini
 
 string current_file_name_ref   \ used to print the file name
 
-\ Indicates if any conf file 

svn commit: r299705 - stable/10/sys/compat/linux

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 14 00:35:49 2016
New Revision: 299705
URL: https://svnweb.freebsd.org/changeset/base/299705

Log:
  MFC r298829
  sys/compat/linux*: minor spelling fixes.

Modified:
  stable/10/sys/compat/linux/check_internal_locks.d
  stable/10/sys/compat/linux/linux_fork.c
  stable/10/sys/compat/linux/linux_misc.c
  stable/10/sys/compat/linux/linux_socket.h
  stable/10/sys/compat/linux/trace_futexes.d
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/check_internal_locks.d
==
--- stable/10/sys/compat/linux/check_internal_locks.d   Sat May 14 00:35:35 
2016(r299704)
+++ stable/10/sys/compat/linux/check_internal_locks.d   Sat May 14 00:35:49 
2016(r299705)
@@ -64,7 +64,7 @@ linuxulator*:locks:futex_mtx:locked
 linuxulator*:locks:futex_mtx:unlock
 /check[probefunc] == 0/
 {
-   printf("ERROR: unlock attemt of unlocked %s (%p),", probefunc, arg0);
+   printf("ERROR: unlock attempt of unlocked %s (%p),", probefunc, arg0);
printf("   missing SDT probe in kernel, or dtrace program started");
printf("   while the %s was already held (race condition).", 
probefunc);
printf("   Stack trace follows:");

Modified: stable/10/sys/compat/linux/linux_fork.c
==
--- stable/10/sys/compat/linux/linux_fork.c Sat May 14 00:35:35 2016
(r299704)
+++ stable/10/sys/compat/linux/linux_fork.c Sat May 14 00:35:49 2016
(r299705)
@@ -157,7 +157,7 @@ linux_clone_proc(struct thread *td, stru
ff |= RFSIGSHARE;
/*
 * XXX: In Linux, sharing of fs info (chroot/cwd/umask)
-* and open files is independant.  In FreeBSD, its in one
+* and open files is independent.  In FreeBSD, its in one
 * structure but in reality it does not cause any problems
 * because both of these flags are usually set together.
 */

Modified: stable/10/sys/compat/linux/linux_misc.c
==
--- stable/10/sys/compat/linux/linux_misc.c Sat May 14 00:35:35 2016
(r299704)
+++ stable/10/sys/compat/linux/linux_misc.c Sat May 14 00:35:49 2016
(r299705)
@@ -200,7 +200,7 @@ linux_alarm(struct thread *td, struct li
 #endif
secs = args->secs;
/*
-* Linux alarm() is always successfull. Limit secs to INT32_MAX / 2
+* Linux alarm() is always successful. Limit secs to INT32_MAX / 2
 * to match kern_setitimer()'s limit to avoid error from it.
 *
 * XXX. Linux limit secs to INT_MAX on 32 and does not limit on 64-bit

Modified: stable/10/sys/compat/linux/linux_socket.h
==
--- stable/10/sys/compat/linux/linux_socket.h   Sat May 14 00:35:35 2016
(r299704)
+++ stable/10/sys/compat/linux/linux_socket.h   Sat May 14 00:35:49 2016
(r299705)
@@ -79,7 +79,7 @@ struct l_cmsghdr {
l_int   cmsg_type;
 };
 
-/* Ancilliary data object information macros */
+/* Ancillary data object information macros */
 
 #define LINUX_CMSG_ALIGN(len)  roundup2(len, sizeof(l_ulong))
 #define LINUX_CMSG_DATA(cmsg)  ((void *)((char *)(cmsg) + \

Modified: stable/10/sys/compat/linux/trace_futexes.d
==
--- stable/10/sys/compat/linux/trace_futexes.d  Sat May 14 00:35:35 2016
(r299704)
+++ stable/10/sys/compat/linux/trace_futexes.d  Sat May 14 00:35:49 2016
(r299705)
@@ -120,7 +120,7 @@ linuxulator*:locks:futex_mtx:locked
 linuxulator*:locks:futex_mtx:unlock
 /check[probefunc, arg0] == 0/
 {
-   printf("ERROR: unlock attemt of unlocked %s (%p),", probefunc, arg0);
+   printf("ERROR: unlock attempt of unlocked %s (%p),", probefunc, arg0);
printf("   missing SDT probe in kernel, or dtrace program started");
printf("   while the %s was already held (race condition).", 
probefunc);
printf("   Stack trace follows:");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299704 - in head: etc/mtree lib/libc/iconv lib/libc/tests lib/libc/tests/iconv

2016-05-13 Thread Eric van Gyzen
Author: vangyzen
Date: Sat May 14 00:35:35 2016
New Revision: 299704
URL: https://svnweb.freebsd.org/changeset/base/299704

Log:
  iconvctl(3): remove superfluous NULL pointer tests
  
  convname and dst are guaranteed to be non-NULL by iconv_open(3).
  src is an array. Remove these tests for NULL pointers.
  While I'm here, eliminate a strlcpy with a correct but suspicious-looking
  calculation for the third parameter (i.e. not a simple sizeof).
  Compare the strings in-place instead of copying.
  
  Found by: bdrewery
  Found by: Coverity
  CID:  1130050, 1130056
  MFC after:3 days
  Sponsored by: Dell Inc.
  Differential Revision: https://reviews.freebsd.org/D6338

Added:
  head/lib/libc/tests/iconv/
  head/lib/libc/tests/iconv/Makefile   (contents, props changed)
  head/lib/libc/tests/iconv/iconvctl_test.c   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/lib/libc/iconv/bsd_iconv.c
  head/lib/libc/tests/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Fri May 13 22:28:02 2016
(r299703)
+++ head/etc/mtree/BSD.tests.dist   Sat May 14 00:35:35 2016
(r299704)
@@ -261,6 +261,8 @@
 data
 ..
 ..
+iconv
+..
 inet
 ..
 locale

Modified: head/lib/libc/iconv/bsd_iconv.c
==
--- head/lib/libc/iconv/bsd_iconv.c Fri May 13 22:28:02 2016
(r299703)
+++ head/lib/libc/iconv/bsd_iconv.c Sat May 14 00:35:35 2016
(r299704)
@@ -267,8 +267,9 @@ __bsd_iconvctl(iconv_t cd, int request, 
struct _citrus_iconv *cv;
struct iconv_hooks *hooks;
const char *convname;
-   char src[PATH_MAX], *dst;
+   char *dst;
int *i;
+   size_t srclen;
 
cv = (struct _citrus_iconv *)(void *)cd;
hooks = (struct iconv_hooks *)argument;
@@ -283,12 +284,9 @@ __bsd_iconvctl(iconv_t cd, int request, 
case ICONV_TRIVIALP:
convname = cv->cv_shared->ci_convname;
dst = strchr(convname, '/');
-
-   strlcpy(src, convname, dst - convname + 1);
+   srclen = dst - convname;
dst++;
-   if ((convname == NULL) || (src == NULL) || (dst == NULL))
-   return (-1);
-   *i = strcmp(src, dst) == 0 ? 1 : 0;
+   *i = (srclen == strlen(dst)) && !memcmp(convname, dst, srclen);
return (0);
case ICONV_GET_TRANSLITERATE:
*i = 1;

Modified: head/lib/libc/tests/Makefile
==
--- head/lib/libc/tests/MakefileFri May 13 22:28:02 2016
(r299703)
+++ head/lib/libc/tests/MakefileSat May 14 00:35:35 2016
(r299704)
@@ -8,6 +8,7 @@ TESTS_SUBDIRS=  c063
 TESTS_SUBDIRS+=db
 TESTS_SUBDIRS+=gen
 TESTS_SUBDIRS+=hash
+TESTS_SUBDIRS+=iconv
 TESTS_SUBDIRS+=inet
 TESTS_SUBDIRS+=net
 TESTS_SUBDIRS+=nss

Added: head/lib/libc/tests/iconv/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/tests/iconv/Makefile  Sat May 14 00:35:35 2016
(r299704)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+TESTSDIR=  ${TESTSBASE}/lib/libc/iconv
+
+ATF_TESTS_C+=  iconvctl_test
+
+.include 

Added: head/lib/libc/tests/iconv/iconvctl_test.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/tests/iconv/iconvctl_test.c   Sat May 14 00:35:35 2016
(r299704)
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2016 Eric van Gyzen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, 

svn commit: r299703 - in head/sys/arm/allwinner: . clk

2016-05-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri May 13 22:28:02 2016
New Revision: 299703
URL: https://svnweb.freebsd.org/changeset/base/299703

Log:
  Use OF_prop_free instead of direct call to free(9)
  
  Approved by:  jmcneill

Modified:
  head/sys/arm/allwinner/a10_gpio.c
  head/sys/arm/allwinner/clk/aw_cpuclk.c
  head/sys/arm/allwinner/clk/aw_lcdclk.c
  head/sys/arm/allwinner/clk/aw_oscclk.c
  head/sys/arm/allwinner/clk/aw_pll.c
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Fri May 13 22:05:16 2016
(r299702)
+++ head/sys/arm/allwinner/a10_gpio.c   Fri May 13 22:28:02 2016
(r299703)
@@ -536,8 +536,8 @@ aw_fdt_configure_pins(device_t dev, phan
}
 
  out:
-   free(pinlist, M_OFWPROP);
-   free(pin_function, M_OFWPROP);
+   OF_prop_free(pinlist);
+   OF_prop_free(pin_function);
return (ret);
 }
 

Modified: head/sys/arm/allwinner/clk/aw_cpuclk.c
==
--- head/sys/arm/allwinner/clk/aw_cpuclk.c  Fri May 13 22:05:16 2016
(r299702)
+++ head/sys/arm/allwinner/clk/aw_cpuclk.c  Fri May 13 22:28:02 2016
(r299703)
@@ -128,8 +128,8 @@ aw_cpuclk_attach(device_t dev)
goto fail;
}
 
-   free(__DECONST(char *, def.clkdef.parent_names), M_OFWPROP);
-   free(__DECONST(char *, def.clkdef.name), M_OFWPROP);
+   OF_prop_free(__DECONST(char *, def.clkdef.parent_names));
+   OF_prop_free(__DECONST(char *, def.clkdef.name));
 
if (bootverbose)
clkdom_dump(clkdom);
@@ -137,7 +137,7 @@ aw_cpuclk_attach(device_t dev)
return (0);
 
 fail:
-   free(__DECONST(char *, def.clkdef.name), M_OFWPROP);
+   OF_prop_free(__DECONST(char *, def.clkdef.name));
return (error);
 }
 

Modified: head/sys/arm/allwinner/clk/aw_lcdclk.c
==
--- head/sys/arm/allwinner/clk/aw_lcdclk.c  Fri May 13 22:05:16 2016
(r299702)
+++ head/sys/arm/allwinner/clk/aw_lcdclk.c  Fri May 13 22:28:02 2016
(r299703)
@@ -529,11 +529,11 @@ aw_lcdclk_attach(device_t dev)
if (sc->type == AW_LCD_CH0)
hwreset_register_ofw_provider(dev);
 
-   free(parent_names, M_OFWPROP);
+   OF_prop_free(parent_names);
return (0);
 
 fail:
-   free(parent_names, M_OFWPROP);
+   OF_prop_free(parent_names);
return (error);
 }
 

Modified: head/sys/arm/allwinner/clk/aw_oscclk.c
==
--- head/sys/arm/allwinner/clk/aw_oscclk.c  Fri May 13 22:05:16 2016
(r299702)
+++ head/sys/arm/allwinner/clk/aw_oscclk.c  Fri May 13 22:28:02 2016
(r299703)
@@ -103,12 +103,12 @@ aw_oscclk_attach(device_t dev)
if (bootverbose)
clkdom_dump(clkdom);
 
-   free(__DECONST(char *, def.clkdef.name), M_OFWPROP);
+   OF_prop_free(__DECONST(char *, def.clkdef.name));
 
return (0);
 
 fail:
-   free(__DECONST(char *, def.clkdef.name), M_OFWPROP);
+   OF_prop_free(__DECONST(char *, def.clkdef.name));
return (error);
 }
 

Modified: head/sys/arm/allwinner/clk/aw_pll.c
==
--- head/sys/arm/allwinner/clk/aw_pll.c Fri May 13 22:05:16 2016
(r299702)
+++ head/sys/arm/allwinner/clk/aw_pll.c Fri May 13 22:28:02 2016
(r299703)
@@ -723,7 +723,7 @@ aw_pll_create(device_t dev, bus_addr_t p
 
clknode_register(clkdom, clk);
 
-   free(__DECONST(char *, clkdef.parent_names), M_OFWPROP);
+   OF_prop_free(__DECONST(char *, clkdef.parent_names));
 
return (0);
 }

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Fri May 13 22:05:16 2016
(r299702)
+++ head/sys/arm/allwinner/if_awg.c Fri May 13 22:28:02 2016
(r299703)
@@ -951,7 +951,7 @@ awg_setup_extres(device_t dev)
tx_parent_name = "emac_int_tx";
else
tx_parent_name = "mii_phy_tx";
-   free(phy_type, M_OFWPROP);
+   OF_prop_free(phy_type);
 
/* Get the TX clock */
error = clk_get_by_ofw_name(dev, "tx", _tx);
@@ -1034,7 +1034,7 @@ awg_setup_extres(device_t dev)
return (0);
 
 fail:
-   free(phy_type, M_OFWPROP);
+   OF_prop_free(phy_type);
 
if (reg != NULL)
regulator_release(reg);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299702 - in head/sys/arm: at91 freescale/imx mv

2016-05-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri May 13 22:05:16 2016
New Revision: 299702
URL: https://svnweb.freebsd.org/changeset/base/299702

Log:
  Use OF_prop_free instead of direct call to free(9)

Modified:
  head/sys/arm/at91/at91_pinctrl.c
  head/sys/arm/freescale/imx/imx_iomux.c
  head/sys/arm/mv/mv_localbus.c

Modified: head/sys/arm/at91/at91_pinctrl.c
==
--- head/sys/arm/at91/at91_pinctrl.cFri May 13 21:26:12 2016
(r299701)
+++ head/sys/arm/at91/at91_pinctrl.cFri May 13 22:05:16 2016
(r299702)
@@ -126,7 +126,7 @@ at91_pinctrl_setup_dinfo(device_t dev, p
resource_list_add(>rl, SYS_RES_MEMORY, k,
phys, phys + size - 1, size);
}
-   free(reg, M_OFWPROP);
+   OF_prop_free(reg);
 
nintr = OF_getencprop_alloc(node, "interrupts",  sizeof(*intr),
(void **));
@@ -154,7 +154,7 @@ at91_pinctrl_setup_dinfo(device_t dev, p
resource_list_add(>rl, SYS_RES_IRQ, k, intr[i],
intr[i], 1);
}
-   free(intr, M_OFWPROP);
+   OF_prop_free(intr);
}
 
return (ndi);
@@ -429,7 +429,7 @@ pinctrl_configure_pins(device_t bus, pha
break;
}
}
-   free(cfgdata, M_OFWPROP);
+   OF_prop_free(cfgdata);
return (0);
 }
 

Modified: head/sys/arm/freescale/imx/imx_iomux.c
==
--- head/sys/arm/freescale/imx/imx_iomux.c  Fri May 13 21:26:12 2016
(r299701)
+++ head/sys/arm/freescale/imx/imx_iomux.c  Fri May 13 22:05:16 2016
(r299702)
@@ -176,7 +176,7 @@ iomux_configure_pins(device_t dev, phand
cfg->padconf_reg, cfg->padconf_val);
}
}
-   free(cfgtuples, M_OFWPROP);
+   OF_prop_free(cfgtuples);
return (0);
 }
 

Modified: head/sys/arm/mv/mv_localbus.c
==
--- head/sys/arm/mv/mv_localbus.c   Fri May 13 21:26:12 2016
(r299701)
+++ head/sys/arm/mv/mv_localbus.c   Fri May 13 22:05:16 2016
(r299702)
@@ -234,7 +234,7 @@ fdt_localbus_reg_decode(phandle_t node, 
}
rv = 0;
 out:
-   free(reg, M_OFWPROP);
+   OF_prop_free(reg);
return (rv);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299701 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 21:26:12 2016
New Revision: 299701
URL: https://svnweb.freebsd.org/changeset/base/299701

Log:
  Move _bsnmptools_debug extern from bsnmpmap.c to bsnmptools.h
  
  It was used in bsnmpmap.c but was stored in bsnmptools.c; moving the extern
  to the header allows us to cover all of our bases for the variable, and allows
  _bsnmptools_debug to be used in the future elsewhere -- not just bsnmpmap.c.
  
  MFC after: 3 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Fri May 13 21:18:10 
2016(r299700)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Fri May 13 21:26:12 
2016(r299701)
@@ -47,7 +47,6 @@
 #include "bsnmptc.h"
 #include "bsnmptools.h"
 
-extern int _bsnmptools_debug;
 #defineDEBUG   if (_bsnmptools_debug) fprintf
 
 /* Allocate memory and initialize list. */

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h   Fri May 13 
21:18:10 2016(r299700)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h   Fri May 13 
21:26:12 2016(r299701)
@@ -231,7 +231,7 @@ extern struct snmp_toolinfo snmptool;
 #defineSET_NONREP(ctx, i)  (((ctx)->flags |= (((i) & 0xff) << 24)))
 #defineGET_NONREP(ctx) (((ctx)->flags & NONREP_BITS) >> 24)
 
-
+extern int _bsnmptools_debug;
 extern const struct asn_oid IsoOrgDod_OID;
 
 int snmptool_init(struct snmp_toolinfo *);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299700 - in head/contrib/jemalloc: . include/jemalloc/internal

2016-05-13 Thread Jason Evans
Author: jasone
Date: Fri May 13 21:18:10 2016
New Revision: 299700
URL: https://svnweb.freebsd.org/changeset/base/299700

Log:
  Work around invalid gcc warning (explicit cast apparently lost).

Modified:
  head/contrib/jemalloc/FREEBSD-diffs
  head/contrib/jemalloc/include/jemalloc/internal/arena.h

Modified: head/contrib/jemalloc/FREEBSD-diffs
==
--- head/contrib/jemalloc/FREEBSD-diffs Fri May 13 21:17:49 2016
(r299699)
+++ head/contrib/jemalloc/FREEBSD-diffs Fri May 13 21:18:10 2016
(r299700)
@@ -46,6 +46,38 @@ index c4a44e3..4626e9b 100644
 +in FreeBSD 11.0.
 +  
  
+diff --git a/include/jemalloc/internal/arena.h 
b/include/jemalloc/internal/arena.h
+index b1de2b6..da6b6d2 100644
+--- a/include/jemalloc/internal/arena.h
 b/include/jemalloc/internal/arena.h
+@@ -718,8 +718,13 @@ arena_miscelm_get_mutable(arena_chunk_t *chunk, size_t 
pageind)
+ JEMALLOC_ALWAYS_INLINE const arena_chunk_map_misc_t *
+ arena_miscelm_get_const(const arena_chunk_t *chunk, size_t pageind)
+ {
++#if 1 /* Work around gcc bug. */
++  arena_chunk_t *mchunk = (arena_chunk_t *)chunk;
+ 
++  return (arena_miscelm_get_mutable(mchunk, pageind));
++#else
+   return (arena_miscelm_get_mutable((arena_chunk_t *)chunk, pageind));
++#endif
+ }
+ 
+ JEMALLOC_ALWAYS_INLINE size_t
+@@ -778,8 +783,13 @@ arena_mapbitsp_get_mutable(arena_chunk_t *chunk, size_t 
pageind)
+ JEMALLOC_ALWAYS_INLINE const size_t *
+ arena_mapbitsp_get_const(const arena_chunk_t *chunk, size_t pageind)
+ {
++#if 1 /* Work around gcc bug. */
++  arena_chunk_t *mchunk = (arena_chunk_t *)chunk;
+ 
++  return (arena_mapbitsp_get_mutable(mchunk, pageind));
++#else
+   return (arena_mapbitsp_get_mutable((arena_chunk_t *)chunk, pageind));
++#endif
+ }
+ 
+ JEMALLOC_ALWAYS_INLINE size_t
 diff --git a/include/jemalloc/internal/jemalloc_internal.h.in 
b/include/jemalloc/internal/jemalloc_internal.h.in
 index 51bf897..7de22ea 100644
 --- a/include/jemalloc/internal/jemalloc_internal.h.in

Modified: head/contrib/jemalloc/include/jemalloc/internal/arena.h
==
--- head/contrib/jemalloc/include/jemalloc/internal/arena.h Fri May 13 
21:17:49 2016(r299699)
+++ head/contrib/jemalloc/include/jemalloc/internal/arena.h Fri May 13 
21:18:10 2016(r299700)
@@ -718,8 +718,13 @@ arena_miscelm_get_mutable(arena_chunk_t 
 JEMALLOC_ALWAYS_INLINE const arena_chunk_map_misc_t *
 arena_miscelm_get_const(const arena_chunk_t *chunk, size_t pageind)
 {
+#if 1 /* Work around gcc bug. */
+   arena_chunk_t *mchunk = (arena_chunk_t *)chunk;
 
+   return (arena_miscelm_get_mutable(mchunk, pageind));
+#else
return (arena_miscelm_get_mutable((arena_chunk_t *)chunk, pageind));
+#endif
 }
 
 JEMALLOC_ALWAYS_INLINE size_t
@@ -778,8 +783,13 @@ arena_mapbitsp_get_mutable(arena_chunk_t
 JEMALLOC_ALWAYS_INLINE const size_t *
 arena_mapbitsp_get_const(const arena_chunk_t *chunk, size_t pageind)
 {
+#if 1 /* Work around gcc bug. */
+   arena_chunk_t *mchunk = (arena_chunk_t *)chunk;
 
+   return (arena_mapbitsp_get_mutable(mchunk, pageind));
+#else
return (arena_mapbitsp_get_mutable((arena_chunk_t *)chunk, pageind));
+#endif
 }
 
 JEMALLOC_ALWAYS_INLINE size_t
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299699 - head/lib/libbsnmp

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 21:17:49 2016
New Revision: 299699
URL: https://svnweb.freebsd.org/changeset/base/299699

Log:
  Remove NO_WERROR from libbsnmp/Makefile.inc
  
  This has been compiling without warnings with clang/gcc for a while now
  
  Tested with: clang 3.8.0, gcc 4.2.x, gcc 5.x
  MFC after: 3 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/lib/libbsnmp/Makefile.inc

Modified: head/lib/libbsnmp/Makefile.inc
==
--- head/lib/libbsnmp/Makefile.inc  Fri May 13 21:12:41 2016
(r299698)
+++ head/lib/libbsnmp/Makefile.inc  Fri May 13 21:17:49 2016
(r299699)
@@ -1,6 +1,5 @@
 # $FreeBSD$
 
-NO_WERROR=
 INCSDIR=   ${INCLUDEDIR}/bsnmp
 PACKAGE=   bsnmp
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299696 - stable/9/sys/dev/sym

2016-05-13 Thread Mark Johnston
Author: markj
Date: Fri May 13 21:05:09 2016
New Revision: 299696
URL: https://svnweb.freebsd.org/changeset/base/299696

Log:
  MFC r299694:
  Fix a bug in r298340: "sim" was referenced after being unset.

Modified:
  stable/9/sys/dev/sym/sym_hipd.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/sym/sym_hipd.c
==
--- stable/9/sys/dev/sym/sym_hipd.c Fri May 13 20:58:25 2016
(r299695)
+++ stable/9/sys/dev/sym/sym_hipd.c Fri May 13 21:05:09 2016
(r299696)
@@ -8903,7 +8903,7 @@ static int sym_cam_attach(hcb_p np)
/*
 *  Establish our async notification handler.
 */
-   if (xpt_register_async(AC_LOST_DEVICE, sym_async, sim, path) !=
+   if (xpt_register_async(AC_LOST_DEVICE, sym_async, np->sim, path) !=
CAM_REQ_CMP)
goto fail;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299695 - stable/10/sys/dev/sym

2016-05-13 Thread Mark Johnston
Author: markj
Date: Fri May 13 20:58:25 2016
New Revision: 299695
URL: https://svnweb.freebsd.org/changeset/base/299695

Log:
  MFC r299694:
  Fix a bug in r298340: "sim" was referenced after being unset.

Modified:
  stable/10/sys/dev/sym/sym_hipd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sym/sym_hipd.c
==
--- stable/10/sys/dev/sym/sym_hipd.cFri May 13 20:54:54 2016
(r299694)
+++ stable/10/sys/dev/sym/sym_hipd.cFri May 13 20:58:25 2016
(r299695)
@@ -8906,7 +8906,7 @@ static int sym_cam_attach(hcb_p np)
/*
 *  Establish our async notification handler.
 */
-   if (xpt_register_async(AC_LOST_DEVICE, sym_async, sim, path) !=
+   if (xpt_register_async(AC_LOST_DEVICE, sym_async, np->sim, path) !=
CAM_REQ_CMP)
goto fail;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299694 - head/sys/dev/sym

2016-05-13 Thread Mark Johnston
Author: markj
Date: Fri May 13 20:54:54 2016
New Revision: 299694
URL: https://svnweb.freebsd.org/changeset/base/299694

Log:
  Fix a bug in r298340: "sim" was referenced after being unset.

Modified:
  head/sys/dev/sym/sym_hipd.c

Modified: head/sys/dev/sym/sym_hipd.c
==
--- head/sys/dev/sym/sym_hipd.c Fri May 13 20:14:41 2016(r299693)
+++ head/sys/dev/sym/sym_hipd.c Fri May 13 20:54:54 2016(r299694)
@@ -8902,7 +8902,7 @@ static int sym_cam_attach(hcb_p np)
/*
 *  Establish our async notification handler.
 */
-   if (xpt_register_async(AC_LOST_DEVICE, sym_async, sim, path) !=
+   if (xpt_register_async(AC_LOST_DEVICE, sym_async, np->sim, path) !=
CAM_REQ_CMP)
goto fail;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299587 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc

2016-05-13 Thread Jason Evans
On May 12, 2016, at 9:03 PM, Jason Evans  wrote:
> 
> Author: jasone
> Date: Fri May 13 04:03:20 2016
> New Revision: 299587
> URL: https://svnweb.freebsd.org/changeset/base/299587
> 
> Log:
>  Update jemalloc to 4.2.0.
> 
> [...]

This trips on an invalid gcc warning for at least mips64 and ppc64.  I'm 
compile-testing a probable workaround right now.

Jason
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299693 - in head/sys: amd64/amd64 riscv/riscv

2016-05-13 Thread Alan Cox
Author: alc
Date: Fri May 13 20:14:41 2016
New Revision: 299693
URL: https://svnweb.freebsd.org/changeset/base/299693

Log:
  Eliminate an unused #include.  For a brief period of time, _unrhdr.h was
  used to implement PCID support on amd64.
  
  Reviewed by:  kib

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri May 13 18:56:56 2016(r299692)
+++ head/sys/amd64/amd64/pmap.c Fri May 13 20:14:41 2016(r299693)
@@ -119,7 +119,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 

Modified: head/sys/riscv/riscv/pmap.c
==
--- head/sys/riscv/riscv/pmap.c Fri May 13 18:56:56 2016(r299692)
+++ head/sys/riscv/riscv/pmap.c Fri May 13 20:14:41 2016(r299693)
@@ -132,7 +132,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299692 - head/sys/dev/bhnd/tools

2016-05-13 Thread Ed Maste
Author: emaste
Date: Fri May 13 18:56:56 2016
New Revision: 299692
URL: https://svnweb.freebsd.org/changeset/base/299692

Log:
  Use awk to run bhnd's awk script, to allow noexec src dir
  
  PR:   209435
  Submitted by: Landon Fuller 
  Differential Revision:https://reviews.freebsd.org/D6312

Modified:
  head/sys/dev/bhnd/tools/nvram_map_gen.sh

Modified: head/sys/dev/bhnd/tools/nvram_map_gen.sh
==
--- head/sys/dev/bhnd/tools/nvram_map_gen.shFri May 13 18:55:03 2016
(r299691)
+++ head/sys/dev/bhnd/tools/nvram_map_gen.shFri May 13 18:56:56 2016
(r299692)
@@ -9,4 +9,4 @@ BHND_TOOLDIR="$(dirname $0)/"
 
 LC_ALL=C; export LC_ALL
 
-"$BHND_TOOLDIR/nvram_map_gen.awk" $@
+"${AWK:-/usr/bin/awk}" -f "$BHND_TOOLDIR/nvram_map_gen.awk" $@
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299691 - head/sys/dev/isp

2016-05-13 Thread Alexander Motin
Author: mav
Date: Fri May 13 18:55:03 2016
New Revision: 299691
URL: https://svnweb.freebsd.org/changeset/base/299691

Log:
  Fix FCP_CMD LENGTH mask in ATIO7 IOCB.
  
  This caused "long IU length (16384) ignored" errors following by others.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/isp/isp_target.c

Modified: head/sys/dev/isp/isp_target.c
==
--- head/sys/dev/isp/isp_target.c   Fri May 13 18:54:48 2016
(r299690)
+++ head/sys/dev/isp/isp_target.c   Fri May 13 18:55:03 2016
(r299691)
@@ -169,7 +169,7 @@ isp_target_notify(ispsoftc_t *isp, void 
 * Check for and do something with commands whose
 * IULEN extends past a single queue entry.
 */
-   len = at7iop->at_ta_len & 0xf;
+   len = at7iop->at_ta_len & 0x0fff;
if (len > (QENTRY_LEN - 8)) {
len -= (QENTRY_LEN - 8);
isp_prt(isp, ISP_LOGINFO, "long IU length (%d) 
ignored", len);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299690 - head/sys/conf

2016-05-13 Thread Ed Maste
Author: emaste
Date: Fri May 13 18:54:48 2016
New Revision: 299690
URL: https://svnweb.freebsd.org/changeset/base/299690

Log:
  Remove sh accidentally added to dependency lines in r299684
  
  Submitted by: Landon Fuller 

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri May 13 18:41:36 2016(r299689)
+++ head/sys/conf/files Fri May 13 18:54:48 2016(r299690)
@@ -10,12 +10,12 @@ acpi_quirks.h   optional acpi   
   \
no-obj no-implicit-rule before-depend  \
clean   "acpi_quirks.h"
 bhnd_nvram_map.h   optional bhndbus | bhnd\
-   dependency  "sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/tools/nvram_map_gen.awk $S/dev/bhnd/nvram/nvram_map" \
+   dependency  "$S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/tools/nvram_map_gen.awk $S/dev/bhnd/nvram/nvram_map" \
compile-with"sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/nvram/nvram_map -h" \
no-obj no-implicit-rule before-depend  \
clean   "bhnd_nvram_map.h"
 bhnd_nvram_map_data.h  optional bhndbus | bhnd\
-   dependency  "sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/tools/nvram_map_gen.awk $S/dev/bhnd/nvram/nvram_map" \
+   dependency  "$S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/tools/nvram_map_gen.awk $S/dev/bhnd/nvram/nvram_map" \
compile-with"sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/nvram/nvram_map -d" \
no-obj no-implicit-rule before-depend  \
clean   "bhnd_nvram_map_data.h"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299590 - head/sys/dev/bxe

2016-05-13 Thread John Baldwin
On Friday, May 13, 2016 05:57:22 AM Scott Long wrote:
> Author: scottl
> Date: Fri May 13 05:57:21 2016
> New Revision: 299590
> URL: https://svnweb.freebsd.org/changeset/base/299590
> 
> Log:
>   Don't jam the softc in the device_probe routine.  The softc isn't owned by
>   the driver here, so it shouldn't be accessed, let alone written to.  Remove
>   the nearby debug line, it's the only thing that depended on the softc, and
>   it depended on it in a way that couldn't work in this part of the code.
>   
>   This fixes some reports of use-after-free and system instability with
>   DEBUG_MEMGUARD enabled.

Actually, softcs are perfectly valid for use in probe routines.  They are just
destroyed on exit.  The softc is allocated by device_set_driver() (and the
previous softc is freed when device_set_driver() is called).  You can see
the calls to 'device_set_driver' (which also set the device name so that
device_printf() works in probe routines) in device_probe_child() (the thing that
calls DEVICE_PROBE()):

int
device_probe_child(device_t dev, device_t child)
{
...
for (; dc; dc = dc->parent) {
for (dl = first_matching_driver(dc, child);
 dl;
 dl = next_matching_driver(dc, child, dl)) {
...
PDEBUG(("Trying %s", DRIVERNAME(dl->driver)));
result = device_set_driver(child, dl->driver);
...

result = DEVICE_PROBE(child);
...
if (result > 0) {
(void)device_set_driver(child, NULL);
continue;
}
...
}
...

}
...
if (best) {
...
result = device_set_driver(child, best->driver);
}
...
}

In the main loop, the 'device_set_driver()' before DEVICE_PROBE() frees the
softc from the previous probe attempt.  If at least one working driver is
found, then best will be non-null and the last 'device_set_driver()' will
free the softc from the last probe attempt and allocate a fresh one to be
used when DEVICE_ATTACH() is invoked.  If no driver was valid, then we
would have called the 'device_set_driver(child, NULL)' case after every
probe.  Looking at the code, it would probably be clearer to just move
that case into an 'else' clause at the end for the 'best == NULL' case.

However, just touching the softc in a probe routine cannot possibly cause
a memory leak.  device_get_softc() does not allocate the softc on demand,
it just returns whatever is already allocated.  While using the softc in
probe routines is often dubious, the commit is wrong in that this cannot
cause memory leaks or use after free.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299653 - head/sys/compat/linuxkpi/common/include/linux

2016-05-13 Thread John Baldwin
On Friday, May 13, 2016 10:10:44 AM Hans Petter Selasky wrote:
> @@ -190,6 +258,7 @@
>  #define  smp_processor_id()  PCPU_GET(cpuid)
>  #define  num_possible_cpus() mp_ncpus
>  #define  num_online_cpus()   mp_ncpus
> +#define  cpu_has_clflush (1)

This is only true on amd64.  More accurate would be:

#ifdef __amd64__
#define cpu_has_clflush (1)
#elif defined(__i386__)
#define cpu_has_clflush (cpu_feature & CPUID_CLFSH)
#else
#define cpu_has_clflush clflush_not_supported
#endif

Presumably you aren't planning to restrict all of OFED and drm2 to only
be used on amd64?

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299689 - head/sys/dev/bwn

2016-05-13 Thread Adrian Chadd
Author: adrian
Date: Fri May 13 18:41:36 2016
New Revision: 299689
URL: https://svnweb.freebsd.org/changeset/base/299689

Log:
  [bwn] add N-PHY related register defintions.
  
  * Add the siba bus phy/mac/bandwidth clock definitions (TGSLOW*)
  * Add the PHY-N register gateway (BWN_PHY_N())
  * Add the PHY-N TX phystat1 register - we need to actually fill out
more of the PHY encoding information when we assemble a frame.
  * Various ancillary stuff
  
  Nothing uses this yet, but I do have CCK/OFDM somewhat working
  in 2GHz mode on a PHY-N device.
  
  Obtained from:b43 (definitions)

Modified:
  head/sys/dev/bwn/if_bwnreg.h

Modified: head/sys/dev/bwn/if_bwnreg.h
==
--- head/sys/dev/bwn/if_bwnreg.hFri May 13 18:20:54 2016
(r299688)
+++ head/sys/dev/bwn/if_bwnreg.hFri May 13 18:41:36 2016
(r299689)
@@ -56,9 +56,17 @@
 #defineBWN_BFH_LDO_PAREF   0x0004
 #defineBWN_BFH_FEM_BT  0x0040
 
-#defineBWN_TGSLOW_SUPPORT_G0x2000
-#defineBWN_TGSLOW_PHYRESET 0x0008
 #defineBWN_TGSLOW_PHYCLOCK_ENABLE  0x0004
+#defineBWN_TGSLOW_PHYRESET 0x0008
+#defineBWN_TMSLOW_MACPHYCLKEN  0x0010  /* MAC PHY 
Clock Control Enable (rev >= 5) */
+#defineBWN_TMSLOW_PLLREFSEL0x0020  /* PLL 
Frequency Reference Select (rev >= 5) */
+/* PHY_BANDWIDTH: N-PHY only */
+#defineBWN_TGSLOW_PHY_BANDWIDTH0x00C0
+#defineBWN_TGSLOW_PHY_BANDWIDTH_10MHZ  0x
+#defineBWN_TGSLOW_PHY_BANDWIDTH_20MHZ  0x0040
+#defineBWN_TGSLOW_PHY_BANDWIDTH_40MHZ  0x0080
+#defineBWN_TGSLOW_SUPPORT_G0x2000
+
 #defineBWN_TGSHIGH_HAVE_2GHZ   0x0001
 #defineBWN_TGSHIGH_HAVE_5GHZ   0x0002
 
@@ -85,6 +93,7 @@
 #defineBWN_DMA4_REASON 0x40
 #defineBWN_DMA4_INTR_MASK  0x44
 #defineBWN_DMA5_INTR_MASK  0x4c
+
 #defineBWN_MACCTL  0x120
 #defineBWN_MACCTL_ON   0x0001
 #defineBWN_MACCTL_MCODE_RUN0x0002
@@ -98,12 +107,18 @@
 #defineBWN_MACCTL_RADIO_LOCK   0x0008
 #defineBWN_MACCTL_BEACON_PROMISC   0x0010
 #defineBWN_MACCTL_PASS_BADPLCP 0x0020
+#defineBWN_MACCTL_PHY_LOCK 0x0020  /* PHY-N? */
 #defineBWN_MACCTL_PASS_CTL 0x0040
 #defineBWN_MACCTL_PASS_BADFCS  0x0080
 #defineBWN_MACCTL_PROMISC  0x0100
 #defineBWN_MACCTL_HWPS 0x0200
 #defineBWN_MACCTL_AWAKE0x0400
+#defineBWN_MACCTL_CLOSEDNET0x0800
+#defineBWN_MACCTL_TBTT_HOLD0x1000
+#defineBWN_MACCTL_DISC_TXSTAT  0x2000
+#defineBWN_MACCTL_DISC_PMQ 0x4000
 #defineBWN_MACCTL_GMODE0x8000
+
 #defineBWN_MACCMD  0x124   /* MAC command */
 #defineBWN_MACCMD_BEACON0_VALID0x0001
 #defineBWN_MACCMD_BEACON1_VALID0x0002
@@ -175,6 +190,13 @@
 #defineBWN_MACFILTER_CONTROL   0x420
 #defineBWN_MACFILTER_DATA  0x422
 #defineBWN_RCMTA_COUNT 0x43c
+
+#defineBWN_PSM_PHY_HDR 0x492
+/* BWN_PSM_PHY_HDR bits */
+#defineBWN_PSM_HDR_MAC_PHY_RESET   0x0001
+#defineBWN_PSM_HDR_MAC_PHY_CLOCK_EN0x0002
+#defineBWN_PSM_HDR_MAC_PHY_FORCE_CLK   0x0004
+
 #defineBWN_RF_HWENABLED_LO 0x49a
 #defineBWN_RF_HWENABLED_LO_MASK(1 << 4)
 #defineBWN_GPIO_CONTROL0x49c
@@ -182,6 +204,8 @@
 #defineBWN_TSF_CFP_START_LOW   0x604
 #defineBWN_TSF_CFP_START_HIGH  0x606
 #defineBWN_TSF_CFP_PRETBTT 0x612
+#defineBWN_TSF_CLK_FRAC_LOW0x62e
+#defineBWN_TSF_CLK_FRAC_HIGH   0x630
 #defineBWN_RNG 0x65a
 #defineBWN_IFSCTL  0x688 /* Interframe space 
control */
 #defineBWN_IFSCTL_USE_EDCF 0x0004
@@ -226,6 +250,15 @@
 #defineBWN_SHARED_KEYIDX_BLOCK 0x05d4
 #defineBWN_SHARED_PSM  0x05f4
 
+/* SHM_SHARED tx iq workarounds */
+#defineBWN_SHM_SH_NPHY_TXIQW0  0x0700
+#defineBWN_SHM_SH_NPHY_TXIQW1  0x0702
+#defineBWN_SHM_SH_NPHY_TXIQW2  0x0704
+#defineBWN_SHM_SH_NPHY_TXIQW3  0x0706
+/* SHM_SHARED tx pwr ctrl */
+#defineBWN_SHM_SH_NPHY_TXPWR_INDX0 0x0708
+#defineBWN_SHM_SH_NPHY_TXPWR_INDX1   

svn commit: r299688 - in head/sys: arm/allwinner arm/allwinner/clk arm/allwinner/h3 arm/conf conf

2016-05-13 Thread Emmanuel Vadot
Author: manu
Date: Fri May 13 18:20:54 2016
New Revision: 299688
URL: https://svnweb.freebsd.org/changeset/base/299688

Log:
  Add support for Allwinner H3 SoC.
  For now clocks, GPIO, Pinmux, UART, MMC, EHCI is supported.
  Tested on OrangePi-One
  
  Reviewed by:  jmcneill
  Approved by:  cognet (mentor)
  Differential Revision:https://reviews.freebsd.org/D6311

Added:
  head/sys/arm/allwinner/h3/
  head/sys/arm/allwinner/h3/files.h3   (contents, props changed)
  head/sys/arm/allwinner/h3/h3_padconf.c   (contents, props changed)
  head/sys/arm/allwinner/h3/h3_r_padconf.c   (contents, props changed)
  head/sys/arm/allwinner/h3/std.h3   (contents, props changed)
Modified:
  head/sys/arm/allwinner/a10_ehci.c
  head/sys/arm/allwinner/a10_gpio.c
  head/sys/arm/allwinner/allwinner_machdep.c
  head/sys/arm/allwinner/allwinner_machdep.h
  head/sys/arm/allwinner/aw_ccu.c
  head/sys/arm/allwinner/aw_usbphy.c
  head/sys/arm/allwinner/clk/aw_gate.c
  head/sys/arm/allwinner/clk/aw_pll.c
  head/sys/arm/allwinner/clk/aw_usbclk.c
  head/sys/arm/allwinner/std.allwinner
  head/sys/arm/conf/ALLWINNER
  head/sys/conf/options.arm

Modified: head/sys/arm/allwinner/a10_ehci.c
==
--- head/sys/arm/allwinner/a10_ehci.c   Fri May 13 17:48:04 2016
(r299687)
+++ head/sys/arm/allwinner/a10_ehci.c   Fri May 13 18:20:54 2016
(r299688)
@@ -113,6 +113,7 @@ static struct ofw_compat_data compat_dat
{ "allwinner,sun6i-a31-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun7i-a20-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun8i-a83t-ehci",  (uintptr_t)_ehci_conf },
+   { "allwinner,sun8i-h3-ehci",(uintptr_t)_ehci_conf },
{ NULL, (uintptr_t)NULL }
 };
 

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Fri May 13 17:48:04 2016
(r299687)
+++ head/sys/arm/allwinner/a10_gpio.c   Fri May 13 18:20:54 2016
(r299688)
@@ -99,6 +99,12 @@ extern const struct allwinner_padconf a3
 extern const struct allwinner_padconf a31_r_padconf;
 #endif
 
+/* Defined in h3_padconf.c */
+#ifdef SOC_ALLWINNER_H3
+extern const struct allwinner_padconf h3_padconf;
+extern const struct allwinner_padconf h3_r_padconf;
+#endif
+
 /* Defined in a83t_padconf.c */
 #ifdef SOC_ALLWINNER_A83T
 extern const struct allwinner_padconf a83t_padconf;
@@ -125,6 +131,10 @@ static struct ofw_compat_data compat_dat
{"allwinner,sun8i-a83t-pinctrl",(uintptr_t)_padconf},
{"allwinner,sun8i-a83t-r-pinctrl",  (uintptr_t)_r_padconf},
 #endif
+#ifdef SOC_ALLWINNER_H3
+   {"allwinner,sun8i-h3-pinctrl",  (uintptr_t)_padconf},
+   {"allwinner,sun8i-h3-r-pinctrl",(uintptr_t)_r_padconf},
+#endif
{NULL,  0}
 };
 

Modified: head/sys/arm/allwinner/allwinner_machdep.c
==
--- head/sys/arm/allwinner/allwinner_machdep.c  Fri May 13 17:48:04 2016
(r299687)
+++ head/sys/arm/allwinner/allwinner_machdep.c  Fri May 13 18:20:54 2016
(r299688)
@@ -103,6 +103,15 @@ a83t_attach(platform_t plat)
return (0);
 }
 
+static int
+h3_attach(platform_t plat)
+{
+   soc_type = ALLWINNERSOC_H3;
+   soc_family = ALLWINNERSOC_SUN8I;
+
+   return (0);
+}
+
 static vm_offset_t
 allwinner_lastaddr(platform_t plat)
 {
@@ -220,6 +229,21 @@ static platform_method_t a83t_methods[] 
 FDT_PLATFORM_DEF(a83t, "a83t", 0, "allwinner,sun8i-a83t", 200);
 #endif
 
+#if defined(SOC_ALLWINNER_H3)
+static platform_method_t h3_methods[] = {
+   PLATFORMMETHOD(platform_attach, h3_attach),
+   PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
+   PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
+#endif
+   PLATFORMMETHOD_END,
+};
+FDT_PLATFORM_DEF(h3, "h3", 0, "allwinner,sun8i-h3", 200);
+#endif
+
 u_int
 allwinner_soc_type(void)
 {

Modified: head/sys/arm/allwinner/allwinner_machdep.h
==
--- head/sys/arm/allwinner/allwinner_machdep.h  Fri May 13 17:48:04 2016
(r299687)
+++ head/sys/arm/allwinner/allwinner_machdep.h  Fri May 13 18:20:54 2016
(r299688)
@@ -34,6 +34,7 @@
 #defineALLWINNERSOC_A130x1300
 #defineALLWINNERSOC_A10S   0x1001
 #defineALLWINNERSOC_A200x2000
+#defineALLWINNERSOC_H3 0x3000
 #defineALLWINNERSOC_A310x3100
 #defineALLWINNERSOC_A31S   0x3101
 #defineALLWINNERSOC_A83T   0x8300

Modified: head/sys/arm/allwinner/aw_ccu.c

svn commit: r299687 - head/usr.sbin/binmiscctl

2016-05-13 Thread Don Lewis
Author: truckman
Date: Fri May 13 17:48:04 2016
New Revision: 299687
URL: https://svnweb.freebsd.org/changeset/base/299687

Log:
  Another attempt at resolving CID 1305629.  The test of cmd == -1
  may make Coverity think that other negative values of cmd (used
  as an index) are possible.  Testing < 0 is a more common idiom
  in any case.
  
  Reported by:  Coverity
  CID:  1305629

Modified:
  head/usr.sbin/binmiscctl/binmiscctl.c

Modified: head/usr.sbin/binmiscctl/binmiscctl.c
==
--- head/usr.sbin/binmiscctl/binmiscctl.c   Fri May 13 17:44:20 2016
(r299686)
+++ head/usr.sbin/binmiscctl/binmiscctl.c   Fri May 13 17:48:04 2016
(r299687)
@@ -416,7 +416,7 @@ main(int argc, char **argv)
 
argc--, argv++;
cmd = demux_cmd(argc, argv);
-   if (cmd == -1)
+   if (cmd < 0)
usage("Error: Unknown command \"%s\"", argv[0]);
argc--, argv++;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299686 - head

2016-05-13 Thread Bryan Drewery
Author: bdrewery
Date: Fri May 13 17:44:20 2016
New Revision: 299686
URL: https://svnweb.freebsd.org/changeset/base/299686

Log:
  Support libsoft for restage.
  
  This is essentially fixing a merge conflict.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri May 13 17:38:59 2016(r299685)
+++ head/Makefile.inc1  Fri May 13 17:44:20 2016(r299686)
@@ -1002,8 +1002,8 @@ restage: .MAKE .PHONY
@echo ">>> Installing everything"
@echo "--"
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
-.if defined(LIB32TMP) && ${MK_LIB32} != "no"
-   ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
+.if defined(LIBCOMPAT)
+   ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat}
 .endif
 
 redistribute: .MAKE .PHONY
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299685 - in head/sys: conf dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware

2016-05-13 Thread Navdeep Parhar
Author: np
Date: Fri May 13 17:38:59 2016
New Revision: 299685
URL: https://svnweb.freebsd.org/changeset/base/299685

Log:
  cxgbe(4): Update T5 and T4 firmwares to 1.15.37.0.
  
  These firmwares were obtained from the "Chelsio T5/T4 Unified Wire
  v2.12.0.3 for Linux" release.  Changes since 1.14.4.0 (which is the
  firmware in -STABLE branches) are in the "Release Notes" accompanying
  the Unified Wire release and are copy-pasted here as well.
  
  22.1. T5 Firmware
  +
  
  Version : 1.15.37.0
  Date: 04/27/2016
  

  
  FIXES
  -
  
  BASE:
   - Fixed an issue in FW_RSS_VI_CONFIG_CMD handling where the default ingress
 queue was ignored.
   - Fixed an issue where adapter failed to load fw by adjusting DRAM frequency.
   - Fixed an issue in watchdog which was causing VM bring-up failure after 
reboot.
   - Fixed 40G link failures with some switches when auto-negotiation enabled.
   - Fixed to improve on link bring-up time.
   - Per port buffer groups size doubled to improve performance.
   - Fixed an issue where bogus d3hot bits were set causing traffic stall.
   - Fixed an issue where sometimes adapter was not seen after reboot.
   - Fixed an issue where iWARP was crashing in conjunction with traffic 
management.
   - Fixed an issue where link failed to come up after removing twinax cable and
 inserting optical module.
  
  ETH
   - Fixed a link flap issue on T580-CR.
  
  OFLD
   - Fixed a potential iSCSI data corruption issue by disabling RxFragEn flag.
  
  FOiSCSI
   - Fixed an issue in recovery path where connection was getting closed before
 recovery processing was done.
   - Fixed an issue in TCP port reuse.
   - Fixed an issue in recovery path when large number (>64) of iSCSI 
connections
 were in use.
   - Returned ENETUNREACH if IP was not been provisioned yet and driver tried to
 use given inerface.
   - Fixed an issue where fw was sending ENETUNREACH event for normal tcp
 disconnection.
  
  DCBX
   - Fixed an issue where iscsi tlv is sent incorrectly to host. (DCBX CEE)
   - Fixed an issue where apply bit set for APP id was affecting the ETS and PFC
settings.(DCBX IEEE)
   - Fixed an issue where app priority values are not handled correctly in fw.
(DCBX IEEE)
   - Fixed an issue where enable/disable dcbx can cause crash. (DCBX CEE,DCBX 
IEEE)
  
  FOFCoE
   - Removed BB6 support.
  
  ENHANCEMENTS
  
  
  BASE:
   - Added new interface to program DCA settings in SGE contexts; allow 32-byte
 IQE size
   - Added PTP interface fw_ptp_ts to support PTP Frequeny and Offset 
adjustment.
   - Added MPS raw interface.
  
  ETH:
   - New mailbox command FW_DCB_IEEE_CMD api added for IEEE dcbx.
  
  OFLD:
   - WR opcode is returned to host in cqe error response.
  
  22.2. T4 Firmware
  +
  
  Version : 1.15.37.0
  Date: 04/27/2016
  

  
  FIXES
  -
  
  BASE:
   - Fixed an issue in FW_RSS_VI_CONFIG_CMD handling where default ingress queue
 was ignored.
   - Fixed an issue in watchdog which was causing VM bring-up failure after 
reboot.
   - Per port buffer groups size doubled to improve performance.
   - Fixed an issue where iWARP was crashing in conjunction with traffic 
management.
  
  FOiSCSI:
   - Fixed an issue in recovery path where connection was getting closed before
 recovery processing was done.
   - Fixed an issue in TCP port reuse.
   - Fixed an issue in recovery path when large number (>64) of iSCSI 
connections
 were in use.
   - Returned ENETUNREACH if IP had not been provisioned yet and driver tried to
 use given inerface.
  
  DCBX
   - Fixed an issue where iscsi tlv is sent incorrectly to host.(DCBX CEE)
   - Fixed an issue where enable/disable dcbx can cause crash in firmware.(DCBX 
CEE)
  
  FOiSCSI
   - Fixes an issue where fw was sending ENETUNREACH event for normal tcp
 disconnection.
  
  FOFCoE
   - Removed BB6 support.
  
  ENHANCEMENTS
  
  
  BASE:
   - Added MPS raw interface.
  
  ETH:
   - New mailbox command FW_DCB_IEEE_CMD api added for IEEE dcbx.
  

  
  Obtained from:Chelsio Communications
  MFC after:6 weeks
  Relnotes: yes
  Sponsored by: Chelsio Communications

Added:
  head/sys/dev/cxgbe/firmware/t4fw-1.15.37.0.bin.uu   (contents, props changed)
  head/sys/dev/cxgbe/firmware/t5fw-1.15.37.0.bin.uu   (contents, props changed)
Deleted:
  head/sys/dev/cxgbe/firmware/t4fw-1.15.28.0.bin.uu
  head/sys/dev/cxgbe/firmware/t5fw-1.15.28.0.bin.uu
Modified:
  head/sys/conf/files
  head/sys/dev/cxgbe/firmware/t4fw_interface.h
  head/sys/modules/cxgbe/t4_firmware/Makefile
  head/sys/modules/cxgbe/t5_firmware/Makefile

Modified: head/sys/conf/files

Re: svn commit: r299588 - head/usr.sbin/binmiscctl

2016-05-13 Thread Don Lewis
On 14 May, Bruce Evans wrote:
> On Fri, 13 May 2016, Don Lewis wrote:
> 
>> Log:
>>  Revert r299584:
>>Mark usage() as __dead2 so that Coverity doesn't think that execution
>>continues after the call and uses a negative array subscript.
>>
>>  Requested by:   bde
> 
> Thanks.
> 
> What was the problem that confused Coverity?

It sees that demux_cmd() can return -1.  It takes the true branch
of "if (cmd == -1)" and calls usage.  It then falls through and thinks
that cmds[] is getting indexed with a negative value on line 423.

Taking a closer look at the comments that Coverity added makes me wonder
if changing the test to "if (cmd < 0)" might unconfuse it.

> This reminds me that even compilers can see that usage() doesn't return,
> by looking ahead and even inlining usage().  This breaks debugging and
> profiling.  clang doesn't support the -funit-at-a-time and
> -fno-inline-functions-called-once needed to reduce its excessive inlining.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299684 - head/sys/conf

2016-05-13 Thread Dimitry Andric
Author: dim
Date: Fri May 13 16:35:37 2016
New Revision: 299684
URL: https://svnweb.freebsd.org/changeset/base/299684

Log:
  After r299241, which added bhnd(4), use sh to run the shell scripts for
  generating nvram maps, to allow a noexec-mounted source directory.
  
  Reported by:  Johan Hendriks 
  PR:   209435

Modified:
  head/sys/conf/files
  head/sys/conf/kmod.mk

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri May 13 16:03:50 2016(r299683)
+++ head/sys/conf/files Fri May 13 16:35:37 2016(r299684)
@@ -10,13 +10,13 @@ acpi_quirks.h   optional acpi   
   \
no-obj no-implicit-rule before-depend  \
clean   "acpi_quirks.h"
 bhnd_nvram_map.h   optional bhndbus | bhnd\
-   dependency  "$S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/tools/nvram_map_gen.awk $S/dev/bhnd/nvram/nvram_map" \
-   compile-with"$S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/nvram/nvram_map -h" \
+   dependency  "sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/tools/nvram_map_gen.awk $S/dev/bhnd/nvram/nvram_map" \
+   compile-with"sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/nvram/nvram_map -h" \
no-obj no-implicit-rule before-depend  \
clean   "bhnd_nvram_map.h"
 bhnd_nvram_map_data.h  optional bhndbus | bhnd\
-   dependency  "$S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/tools/nvram_map_gen.awk $S/dev/bhnd/nvram/nvram_map" \
-   compile-with"$S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/nvram/nvram_map -d" \
+   dependency  "sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/tools/nvram_map_gen.awk $S/dev/bhnd/nvram/nvram_map" \
+   compile-with"sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/nvram/nvram_map -d" \
no-obj no-implicit-rule before-depend  \
clean   "bhnd_nvram_map_data.h"
 #

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Fri May 13 16:03:50 2016(r299683)
+++ head/sys/conf/kmod.mk   Fri May 13 16:35:37 2016(r299684)
@@ -417,7 +417,7 @@ bhnd_nvram_map.h: ${SYSDIR}/dev/bhnd/too
 ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
 ${SYSDIR}/dev/bhnd/nvram/nvram_map
 bhnd_nvram_map.h:
-   ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
+   sh ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
${SYSDIR}/dev/bhnd/nvram/nvram_map -h
 .endif
 
@@ -427,7 +427,7 @@ bhnd_nvram_map_data.h: ${SYSDIR}/dev/bhn
 ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
 ${SYSDIR}/dev/bhnd/nvram/nvram_map
 bhnd_nvram_map_data.h:
-   ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
+   sh ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
${SYSDIR}/dev/bhnd/nvram/nvram_map -d
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299683 - in head/sys/arm64: arm64 include

2016-05-13 Thread Andrew Turner
Author: andrew
Date: Fri May 13 16:03:50 2016
New Revision: 299683
URL: https://svnweb.freebsd.org/changeset/base/299683

Log:
  Add support to the arm64 busdma to handle the cache. For now this is
  disabled, however when we enable it it will default to assume memory is
  not cache-coherent, unless either the tag was created or the parent was
  marked as cache-coherent.
  
  Obtained from:ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/busdma_bounce.c
  head/sys/arm64/include/cpufunc.h

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cFri May 13 15:57:55 2016
(r299682)
+++ head/sys/arm64/arm64/busdma_bounce.cFri May 13 16:03:50 2016
(r299683)
@@ -1,8 +1,11 @@
 /*-
  * Copyright (c) 1997, 1998 Justin T. Gibbs.
- * Copyright (c) 2015 The FreeBSD Foundation
+ * Copyright (c) 2015-2016 The FreeBSD Foundation
  * All rights reserved.
  *
+ * Portions of this software were developed by Andrew Turner
+ * under sponsorship of the FreeBSD Foundation.
+ *
  * Portions of this software were developed by Semihalf
  * under sponsorship of the FreeBSD Foundation.
  *
@@ -62,6 +65,7 @@ enum {
BF_COULD_BOUNCE = 0x01,
BF_MIN_ALLOC_COMP   = 0x02,
BF_KMEM_ALLOC   = 0x04,
+   BF_COHERENT = 0x10,
 };
 
 struct bounce_zone;
@@ -113,6 +117,13 @@ static SYSCTL_NODE(_hw, OID_AUTO, busdma
 SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, _bpages, 0,
   "Total bounce pages");
 
+struct sync_list {
+   vm_offset_t vaddr;  /* kva of client data */
+   bus_addr_t  paddr;  /* physical address */
+   vm_page_t   pages;  /* starting page of client data */
+   bus_size_t  datacount;  /* client data count */
+};
+
 struct bus_dmamap {
struct bp_list bpages;
intpagesneeded;
@@ -125,6 +136,8 @@ struct bus_dmamap {
u_int   flags;
 #defineDMAMAP_COULD_BOUNCE (1 << 0)
 #defineDMAMAP_FROM_DMAMEM  (1 << 1)
+   int sync_count;
+   struct sync_listslist[];
 };
 
 static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist;
@@ -171,9 +184,19 @@ bounce_bus_dma_tag_create(bus_dma_tag_t 
newtag->map_count = 0;
newtag->segments = NULL;
 
-   if (parent != NULL && ((newtag->common.filter != NULL) ||
-   ((parent->bounce_flags & BF_COULD_BOUNCE) != 0)))
-   newtag->bounce_flags |= BF_COULD_BOUNCE;
+#ifdef notyet
+   if ((flags & BUS_DMA_COHERENT) != 0)
+   newtag->bounce_flags |= BF_COHERENT;
+#endif
+
+   if (parent != NULL) {
+   if ((newtag->common.filter != NULL ||
+   (parent->bounce_flags & BF_COULD_BOUNCE) != 0))
+   newtag->bounce_flags |= BF_COULD_BOUNCE;
+
+   /* Copy some flags from the parent */
+   newtag->bounce_flags |= parent->bounce_flags & BF_COHERENT;
+   }
 
if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) ||
newtag->common.alignment > 1)
@@ -251,11 +274,14 @@ out:
 }
 
 static bus_dmamap_t
-alloc_dmamap(int flags)
+alloc_dmamap(bus_dma_tag_t dmat, int flags)
 {
+   u_long mapsize;
bus_dmamap_t map;
 
-   map = malloc(sizeof(*map), M_DEVBUF, flags | M_ZERO);
+   mapsize = sizeof(*map);
+   mapsize += sizeof(struct sync_list) * dmat->common.nsegments;
+   map = malloc(mapsize, M_DEVBUF, flags | M_ZERO);
if (map == NULL)
return (NULL);
 
@@ -288,7 +314,7 @@ bounce_bus_dmamap_create(bus_dma_tag_t d
}
}
 
-   *mapp = alloc_dmamap(M_NOWAIT);
+   *mapp = alloc_dmamap(dmat, M_NOWAIT);
if (*mapp == NULL) {
CTR3(KTR_BUSDMA, "%s: tag %p error %d",
__func__, dmat, ENOMEM);
@@ -360,7 +386,7 @@ bounce_bus_dmamap_destroy(bus_dma_tag_t 
if ((map->flags & DMAMAP_FROM_DMAMEM) != 0)
panic("bounce_bus_dmamap_destroy: Invalid map freed\n");
 
-   if (STAILQ_FIRST(>bpages) != NULL) {
+   if (STAILQ_FIRST(>bpages) != NULL || map->sync_count != 0) {
CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, EBUSY);
return (EBUSY);
}
@@ -421,7 +447,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dm
 * Create the map, but don't set the could bounce flag as
 * this allocation should never bounce;
 */
-   *mapp = alloc_dmamap(mflags);
+   *mapp = alloc_dmamap(dmat, mflags);
if (*mapp == NULL) {
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
__func__, dmat, dmat->common.flags, ENOMEM);
@@ -644,8 +670,9 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_
 vm_paddr_t 

svn commit: r299682 - head/usr.sbin/i2c

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 13 15:57:55 2016
New Revision: 299682
URL: https://svnweb.freebsd.org/changeset/base/299682

Log:
  i2c(8): uninitialized variable (UNINIT).
  
  If i2c_opt.width is somehow zero, buf will be left uninitialized and may
  cause trouble later on. This is a followup to r299586.
  
  CID:  1331548

Modified:
  head/usr.sbin/i2c/i2c.c

Modified: head/usr.sbin/i2c/i2c.c
==
--- head/usr.sbin/i2c/i2c.c Fri May 13 15:32:16 2016(r299681)
+++ head/usr.sbin/i2c/i2c.c Fri May 13 15:57:55 2016(r299682)
@@ -294,8 +294,10 @@ i2c_write(char *dev, struct options i2c_
err_msg = "error: offset malloc";
goto err1;
}
-   } else
+   } else {
bufsize = 0;
+   buf = NULL;
+   }
 
switch(i2c_opt.mode) {
case I2C_MODE_STOP_START:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299678 - head/sys/x86/x86

2016-05-13 Thread Pintér , Olivér
On Fri, May 13, 2016 at 5:16 PM, Ed Maste  wrote:

> On 13 May 2016 at 11:11, Bjoern A. Zeeb  wrote:
> > Author: bz
> > Date: Fri May 13 15:11:17 2016
> > New Revision: 299678
> > URL: https://svnweb.freebsd.org/changeset/base/299678
> >
> ...
> > -SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RD,
> _erratum383, 0,
> > +SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RD|CTLFLAG_RDTUN,
> > +_erratum383, 0,
>
> Note that CTLFLAG_RDTUN is already (CTLFLAG_RD|CTLFLAG_TUN) so there's
> no need for CTLFLAG_RD
>

Fix me, but this only true for 11-CURRENT, and not for older releases.

> ___
> svn-src-h...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299588 - head/usr.sbin/binmiscctl

2016-05-13 Thread Bruce Evans

On Fri, 13 May 2016, Don Lewis wrote:


Log:
 Revert r299584:
   Mark usage() as __dead2 so that Coverity doesn't think that execution
   continues after the call and uses a negative array subscript.

 Requested by:  bde


Thanks.

What was the problem that confused Coverity?

This reminds me that even compilers can see that usage() doesn't return,
by looking ahead and even inlining usage().  This breaks debugging and
profiling.  clang doesn't support the -funit-at-a-time and
-fno-inline-functions-called-once needed to reduce its excessive inlining.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299681 - head/sys/conf

2016-05-13 Thread Bjoern A. Zeeb
Author: bz
Date: Fri May 13 15:32:16 2016
New Revision: 299681
URL: https://svnweb.freebsd.org/changeset/base/299681

Log:
  hunt_ev.c was deleted with r299596.  Remove it from the files list to
  (hopefully) unbreak amd64 LINT kernels.
  
  MFC after:1 week

Modified:
  head/sys/conf/files.amd64

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Fri May 13 15:29:40 2016(r299680)
+++ head/sys/conf/files.amd64   Fri May 13 15:32:16 2016(r299681)
@@ -332,7 +332,6 @@ dev/sfxge/common/efx_sram.c optionalsfx
 dev/sfxge/common/efx_tx.c  optionalsfxge pci
 dev/sfxge/common/efx_vpd.c optionalsfxge pci
 dev/sfxge/common/efx_wol.c optionalsfxge pci
-dev/sfxge/common/hunt_ev.c optionalsfxge pci
 dev/sfxge/common/hunt_filter.c optionalsfxge pci
 dev/sfxge/common/hunt_intr.c   optionalsfxge pci
 dev/sfxge/common/hunt_mac.coptionalsfxge pci
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299680 - head/sys/x86/x86

2016-05-13 Thread Bjoern A. Zeeb
Author: bz
Date: Fri May 13 15:29:40 2016
New Revision: 299680
URL: https://svnweb.freebsd.org/changeset/base/299680

Log:
  Remove the extra _RD as _RDTUN already includes it.
  
  Submitted by: emaste
  MFC after:2 weeks

Modified:
  head/sys/x86/x86/mca.c

Modified: head/sys/x86/x86/mca.c
==
--- head/sys/x86/x86/mca.c  Fri May 13 15:15:54 2016(r299679)
+++ head/sys/x86/x86/mca.c  Fri May 13 15:29:40 2016(r299680)
@@ -104,7 +104,7 @@ SYSCTL_INT(_hw_mca, OID_AUTO, intel6h_HS
 "Administrative toggle for logging of spurious corrected errors");
 
 int workaround_erratum383;
-SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RD|CTLFLAG_RDTUN,
+SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RDTUN,
 _erratum383, 0,
 "Is the workaround for Erratum 383 on AMD Family 10h processors enabled?");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299679 - head/sys/dev/mmc/host

2016-05-13 Thread Andrew Turner
Author: andrew
Date: Fri May 13 15:15:54 2016
New Revision: 299679
URL: https://svnweb.freebsd.org/changeset/base/299679

Log:
  Add DMA sync operations around accessing the dwmmc descriptor ring. Even
  with it maps as cache-coherent we still need to call bus_dmamap_sync.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/mmc/host/dwmmc.c

Modified: head/sys/dev/mmc/host/dwmmc.c
==
--- head/sys/dev/mmc/host/dwmmc.c   Fri May 13 15:11:17 2016
(r299678)
+++ head/sys/dev/mmc/host/dwmmc.c   Fri May 13 15:15:54 2016
(r299679)
@@ -722,6 +722,9 @@ dma_done(struct dwmmc_softc *sc, struct 
bus_dmamap_sync(sc->buf_tag, sc->buf_map,
BUS_DMASYNC_POSTREAD);
 
+   bus_dmamap_sync(sc->desc_tag, sc->desc_map,
+   BUS_DMASYNC_POSTWRITE);
+
bus_dmamap_unload(sc->buf_tag, sc->buf_map);
 
return (0);
@@ -766,6 +769,10 @@ dma_prepare(struct dwmmc_softc *sc, stru
if (err != 0)
panic("dmamap_load failed\n");
 
+   /* Ensure the device can see the desc */
+   bus_dmamap_sync(sc->desc_tag, sc->desc_map,
+   BUS_DMASYNC_PREWRITE);
+
if (data->flags & MMC_DATA_WRITE)
bus_dmamap_sync(sc->buf_tag, sc->buf_map,
BUS_DMASYNC_PREWRITE);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299678 - head/sys/x86/x86

2016-05-13 Thread Ed Maste
On 13 May 2016 at 11:11, Bjoern A. Zeeb  wrote:
> Author: bz
> Date: Fri May 13 15:11:17 2016
> New Revision: 299678
> URL: https://svnweb.freebsd.org/changeset/base/299678
>
...
> -SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RD, 
> _erratum383, 0,
> +SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RD|CTLFLAG_RDTUN,
> +_erratum383, 0,

Note that CTLFLAG_RDTUN is already (CTLFLAG_RD|CTLFLAG_TUN) so there's
no need for CTLFLAG_RD
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299678 - head/sys/x86/x86

2016-05-13 Thread Bjoern A. Zeeb
Author: bz
Date: Fri May 13 15:11:17 2016
New Revision: 299678
URL: https://svnweb.freebsd.org/changeset/base/299678

Log:
  We already turn the AMD erratum383 workaround on for certain VM_GUEST_VM
  if specific CPU features are not present.
  Some simulation environments, e.g. gem5, have been found to require more
  TLB management from the kernel in certain setups. It is currently unclear why.
  Turning on the workaround_erratum383 seems to help and make problems (panics)
  go away.
  Given this is a fairly uncommon environment so far, allowing the workaround
  to be manually enabled from loader in order to make debugging and comparing
  traces easier, but also to allow gem5 run FreeBSD in X86 timing mode, seems
  to be the least intrusive option for now until the issue if fully understood.
  
  Sponsored by: DARPA/AFRL
  Reviewed by:  kib, alc (earlier)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D6206

Modified:
  head/sys/x86/x86/mca.c

Modified: head/sys/x86/x86/mca.c
==
--- head/sys/x86/x86/mca.c  Fri May 13 15:09:38 2016(r299677)
+++ head/sys/x86/x86/mca.c  Fri May 13 15:11:17 2016(r299678)
@@ -104,7 +104,8 @@ SYSCTL_INT(_hw_mca, OID_AUTO, intel6h_HS
 "Administrative toggle for logging of spurious corrected errors");
 
 int workaround_erratum383;
-SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RD, _erratum383, 
0,
+SYSCTL_INT(_hw_mca, OID_AUTO, erratum383, CTLFLAG_RD|CTLFLAG_RDTUN,
+_erratum383, 0,
 "Is the workaround for Erratum 383 on AMD Family 10h processors enabled?");
 
 static STAILQ_HEAD(, mca_internal) mca_freelist;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299677 - in stable/10/sys: cam kern

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 13 15:09:38 2016
New Revision: 299677
URL: https://svnweb.freebsd.org/changeset/base/299677

Log:
  MFC r298809, r298817
  Minor spelling fixes.

Modified:
  stable/10/sys/cam/cam_queue.c
  stable/10/sys/kern/vfs_bio.c
  stable/10/sys/kern/vfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/cam_queue.c
==
--- stable/10/sys/cam/cam_queue.c   Fri May 13 14:59:02 2016
(r299676)
+++ stable/10/sys/cam/cam_queue.c   Fri May 13 15:09:38 2016
(r299677)
@@ -122,7 +122,7 @@ camq_resize(struct camq *queue, int new_
cam_pinfo **new_array;
 
KASSERT(new_size >= queue->entries, ("camq_resize: "
-   "New queue size can't accomodate queued entries (%d < %d).",
+   "New queue size can't accommodate queued entries (%d < %d).",
new_size, queue->entries));
new_array = (cam_pinfo **)malloc(new_size * sizeof(cam_pinfo *),
 M_CAMQ, M_NOWAIT);

Modified: stable/10/sys/kern/vfs_bio.c
==
--- stable/10/sys/kern/vfs_bio.cFri May 13 14:59:02 2016
(r299676)
+++ stable/10/sys/kern/vfs_bio.cFri May 13 15:09:38 2016
(r299677)
@@ -210,7 +210,7 @@ SYSCTL_INT(_vfs, OID_AUTO, getnewbufcall
"Number of calls to getnewbuf");
 static int getnewbufrestarts;
 SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW, , 
0,
-"Number of times getnewbuf has had to restart a buffer aquisition");
+"Number of times getnewbuf has had to restart a buffer acquisition");
 static int mappingrestarts;
 SYSCTL_INT(_vfs, OID_AUTO, mappingrestarts, CTLFLAG_RW, , 0,
 "Number of times getblk has had to restart a buffer mapping for "
@@ -738,7 +738,7 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon
else
bio_transient_maxcnt = biotmap_sz / MAXPHYS;
/*
-* Artifically limit to 1024 simultaneous in-flight I/Os
+* Artificially limit to 1024 simultaneous in-flight I/Os
 * using the transient mapping.
 */
if (bio_transient_maxcnt > 1024)
@@ -3088,7 +3088,7 @@ has_addr:
  * to clear B_INVAL.  If the caller does this without issuing an I/O, 
  * the caller should set B_CACHE ( as an optimization ), else the caller
  * should issue the I/O and biodone() will set B_CACHE if the I/O was
- * a write attempt or if it was a successfull read.  If the caller 
+ * a write attempt or if it was a successful read.  If the caller 
  * intends to issue a READ, the caller must clear B_INVAL and BIO_ERROR
  * prior to issuing the READ.  biodone() will *not* clear B_INVAL.
  */
@@ -3200,7 +3200,7 @@ loop:
bp_unmapped_get_kva(bp, blkno, size, flags);
 
/*
-* If the size is inconsistant in the VMIO case, we can resize
+* If the size is inconsistent in the VMIO case, we can resize
 * the buffer.  This might lead to B_CACHE getting set or
 * cleared.  If the size has not changed, B_CACHE remains
 * unchanged from its previous state.
@@ -3369,7 +3369,7 @@ geteblk(int size, int flags)
  * resize a buffer up or down.
  *
  * Note that this code is tricky, and has many complications to resolve
- * deadlock or inconsistant data situations.  Tread lightly!!! 
+ * deadlock or inconsistent data situations.  Tread lightly!!! 
  * There are B_CACHE and B_DELWRI interactions that must be dealt with by 
  * the caller.  Calling this code willy nilly can result in the loss of data.
  *
@@ -3799,11 +3799,11 @@ dev_strategy_csw(struct cdev *dev, struc
  * assuming B_INVAL is clear.
  *
  * For the VMIO case, we set B_CACHE if the op was a read and no
- * read error occured, or if the op was a write.  B_CACHE is never
+ * read error occurred, or if the op was a write.  B_CACHE is never
  * set if the buffer is invalid or otherwise uncacheable.
  *
  * biodone does not mess with B_INVAL, allowing the I/O routine or the
- * initiator to leave B_INVAL set to brelse the buffer out of existance
+ * initiator to leave B_INVAL set to brelse the buffer out of existence
  * in the biodone routine.
  */
 void
@@ -3869,7 +3869,7 @@ bufdone_finish(struct buf *bp)
 
/*
 * Set B_CACHE if the op was a normal read and no error
-* occured.  B_CACHE is set for writes in the b*write()
+* occurred.  B_CACHE is set for writes in the b*write()
 * routines.
 */
iosize = bp->b_bcount - bp->b_resid;
@@ -3947,7 +3947,7 @@ bufdone_finish(struct buf *bp)
 /*
  * This routine is called in lieu of iodone in the case of
  * incomplete I/O.  This keeps 

svn commit: r299676 - head/usr.sbin/bhyve

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 13 14:59:02 2016
New Revision: 299676
URL: https://svnweb.freebsd.org/changeset/base/299676

Log:
  bhyve: consider the bogus case of a negative bar idx.
  
  This is a followup to r297472 to squelch Coverity.
  
  CID:  1194319

Modified:
  head/usr.sbin/bhyve/pci_emul.c

Modified: head/usr.sbin/bhyve/pci_emul.c
==
--- head/usr.sbin/bhyve/pci_emul.c  Fri May 13 14:38:04 2016
(r299675)
+++ head/usr.sbin/bhyve/pci_emul.c  Fri May 13 14:59:02 2016
(r299676)
@@ -2034,7 +2034,7 @@ pci_emul_diow(struct vmctx *ctx, int vcp
 */
}
 
-   if (baridx > 2) {
+   if (baridx > 2 || baridx < 0) {
printf("diow: unknown bar idx %d\n", baridx);
}
 }
@@ -2089,7 +2089,7 @@ pci_emul_dior(struct vmctx *ctx, int vcp
}
 
 
-   if (baridx > 2) {
+   if (baridx > 2 || baridx < 0) {
printf("dior: unknown bar idx %d\n", baridx);
return (0);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299675 - head/usr.sbin/bhyve

2016-05-13 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 13 14:38:04 2016
New Revision: 299675
URL: https://svnweb.freebsd.org/changeset/base/299675

Log:
  bhyve: replace uninitialized variable "offset".
  
  Use io->io_req.br_offset instead.
  
  Suggested by: grehan
  CID:  1288937

Modified:
  head/usr.sbin/bhyve/pci_virtio_block.c

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==
--- head/usr.sbin/bhyve/pci_virtio_block.c  Fri May 13 13:01:02 2016
(r299674)
+++ head/usr.sbin/bhyve/pci_virtio_block.c  Fri May 13 14:38:04 2016
(r299675)
@@ -200,7 +200,6 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
int err;
ssize_t iolen;
int writeop, type;
-   off_t offset;
struct iovec iov[BLOCKIF_IOV_MAX + 2];
uint16_t idx, flags[BLOCKIF_IOV_MAX + 2];
 
@@ -249,7 +248,8 @@ pci_vtblk_proc(struct pci_vtblk_softc *s
io->io_req.br_resid = iolen;
 
DPRINTF(("virtio-block: %s op, %zd bytes, %d segs, offset %ld\n\r", 
-writeop ? "write" : "read/ident", iolen, i - 1, offset));
+writeop ? "write" : "read/ident", iolen, i - 1,
+io->io_req.br_offset));
 
switch (type) {
case VBH_OP_READ:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299674 - head/sys/compat/linuxkpi/common/include/linux

2016-05-13 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 13 13:01:02 2016
New Revision: 299674
URL: https://svnweb.freebsd.org/changeset/base/299674

Log:
  Handle case of class being set, but not parent when calling
  device_register() in the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Fri May 13 
12:41:21 2016(r299673)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Fri May 13 
13:01:02 2016(r299674)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -203,11 +203,15 @@ device_register(struct device *dev)
int unit;
 
bsddev = NULL;
+   unit = -1;
+
if (dev->devt) {
unit = MINOR(dev->devt);
bsddev = devclass_get_device(dev->class->bsdclass, unit);
-   } else
-   unit = -1;
+   } else if (dev->parent == NULL) {
+   bsddev = devclass_get_device(dev->class->bsdclass, 0);
+   }
+
if (bsddev == NULL)
bsddev = device_add_child(dev->parent->bsddev,
dev->class->kobj.name, unit);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299673 - in head/sys/compat/linuxkpi/common/include: asm linux

2016-05-13 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 13 12:41:21 2016
New Revision: 299673
URL: https://svnweb.freebsd.org/changeset/base/299673

Log:
  Add more PAGE related defines to the LinuxKPI. Move the definition of
  "pgprot_t" to "linux/page.h" similar to what Linux does.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/pgtable.h
  head/sys/compat/linuxkpi/common/include/linux/page.h

Modified: head/sys/compat/linuxkpi/common/include/asm/pgtable.h
==
--- head/sys/compat/linuxkpi/common/include/asm/pgtable.h   Fri May 13 
12:24:39 2016(r299672)
+++ head/sys/compat/linuxkpi/common/include/asm/pgtable.h   Fri May 13 
12:41:21 2016(r299673)
@@ -31,6 +31,6 @@
 #ifndef _ASM_PGTABLE_H_
 #define_ASM_PGTABLE_H_
 
-typedef intpgprot_t;
+#include 
 
 #endif /* _ASM_PGTABLE_H_ */

Modified: head/sys/compat/linuxkpi/common/include/linux/page.h
==
--- head/sys/compat/linuxkpi/common/include/linux/page.hFri May 13 
12:24:39 2016(r299672)
+++ head/sys/compat/linuxkpi/common/include/linux/page.hFri May 13 
12:41:21 2016(r299673)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,16 +38,33 @@
 #include 
 #include 
 #include 
+#include 
+
+typedef unsigned long pgprot_t;
 
 #define page   vm_page
 
-#definevirt_to_page(x) PHYS_TO_VM_PAGE(vtophys((x)))
+#definevirt_to_page(x) PHYS_TO_VM_PAGE(vtophys((x)))
+#definepage_to_pfn(pp) (VM_PAGE_TO_PHYS((pp)) >> PAGE_SHIFT)
+#definepfn_to_page(pfn)(PHYS_TO_VM_PAGE((pfn) << PAGE_SHIFT))
+#definenth_page(page,n)pfn_to_page(page_to_pfn((page)) + (n))
 
 #defineclear_page(page)memset((page), 0, PAGE_SIZE)
-#definepgprot_noncached(prot)  VM_MEMATTR_UNCACHEABLE
-#definepgprot_writecombine(prot)   VM_MEMATTR_WRITE_COMBINING
+#definepgprot_noncached(prot)  
((pgprot_t)VM_MEMATTR_UNCACHEABLE)
+#definepgprot_writecombine(prot)   
((pgprot_t)VM_MEMATTR_WRITE_COMBINING)
 
 #undef PAGE_MASK
 #definePAGE_MASK   (~(PAGE_SIZE-1))
+/*
+ * Modifying PAGE_MASK in the above way breaks trunc_page, round_page,
+ * and btoc macros. Therefore, redefine them in a way that makes sense
+ * so the LinuxKPI consumers don't get totally broken behavior.
+ */
+#undef btoc
+#definebtoc(x) (((vm_offset_t)(x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
+#undef round_page
+#defineround_page(x)   uintptr_t)(x)) + PAGE_SIZE - 1) & 
~(PAGE_SIZE - 1))
+#undef trunc_page
+#definetrunc_page(x)   ((uintptr_t)(x) & ~(PAGE_SIZE - 1))
 
 #endif /* _LINUX_PAGE_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299672 - head/sys/dev/mrsas

2016-05-13 Thread Kashyap D Desai
Author: kadesai
Date: Fri May 13 12:24:39 2016
New Revision: 299672
URL: https://svnweb.freebsd.org/changeset/base/299672

Log:
  Version update patch.
  
  Submitted by:   Sumit Saxena 
  Reviewed by:Kashyap Desai 
  MFC after:  3 days
  Sponsored by:   AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.h

Modified: head/sys/dev/mrsas/mrsas.h
==
--- head/sys/dev/mrsas/mrsas.h  Fri May 13 12:21:50 2016(r299671)
+++ head/sys/dev/mrsas/mrsas.h  Fri May 13 12:24:39 2016(r299672)
@@ -104,7 +104,7 @@ __FBSDID("$FreeBSD$");
  */
 #defineBYTE_ALIGNMENT  1
 #defineMRSAS_MAX_NAME_LENGTH   32
-#defineMRSAS_VERSION   
"06.707.05.00-fbsd"
+#defineMRSAS_VERSION   
"06.709.07.00-fbsd"
 #defineMRSAS_ULONG_MAX 
0x
 #defineMRSAS_DEFAULT_TIMEOUT   0x14/* Temporarily 
set */
 #defineDONE0
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299671 - head/sys/dev/mrsas

2016-05-13 Thread Kashyap D Desai
Author: kadesai
Date: Fri May 13 12:21:50 2016
New Revision: 299671
URL: https://svnweb.freebsd.org/changeset/base/299671

Log:
  Following bugs fixed as part of this patch:
  .Kernel panic while collecting kdump (reported by Doug A.)
  .NULL pointer dereference at sertain places
  .Removed dead codes
  
  Submitted by:   Sumit Saxena 
  Reviewed by:Kashyap Desai 
  MFC after:  3 days
  Sponsored by:   AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/mrsas/mrsas_fp.c
  head/sys/dev/mrsas/mrsas_ioctl.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Fri May 13 12:18:12 2016(r299670)
+++ head/sys/dev/mrsas/mrsas.c  Fri May 13 12:21:50 2016(r299671)
@@ -84,7 +84,6 @@ static int mrsas_init_fw(struct mrsas_so
 static int mrsas_setup_raidmap(struct mrsas_softc *sc);
 static void megasas_setup_jbod_map(struct mrsas_softc *sc);
 static int megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend);
-static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
 static int mrsas_clear_intr(struct mrsas_softc *sc);
 static int mrsas_get_ctrl_info(struct mrsas_softc *sc);
 static void mrsas_update_ext_vd_details(struct mrsas_softc *sc);
@@ -110,6 +109,7 @@ int mrsas_issue_dcmd(struct mrsas_softc 
 intmrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
 intmrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason);
 intmrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t 
check_reason);
+int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
 int
 mrsas_issue_blocked_cmd(struct mrsas_softc *sc,
 struct mrsas_mfi_cmd *cmd);
@@ -827,6 +827,8 @@ mrsas_attach(device_t dev)
struct mrsas_softc *sc = device_get_softc(dev);
uint32_t cmd, bar, error;
 
+   memset(sc, 0, sizeof(struct mrsas_softc));
+
/* Look up our softc and initialize its fields. */
sc->mrsas_dev = dev;
sc->device_id = pci_get_device(dev);
@@ -1280,9 +1282,7 @@ mrsas_teardown_intr(struct mrsas_softc *
 static int
 mrsas_suspend(device_t dev)
 {
-   struct mrsas_softc *sc;
-
-   sc = device_get_softc(dev);
+   /* This will be filled when the driver will have hibernation support */
return (0);
 }
 
@@ -1295,9 +1295,7 @@ mrsas_suspend(device_t dev)
 static int
 mrsas_resume(device_t dev)
 {
-   struct mrsas_softc *sc;
-
-   sc = device_get_softc(dev);
+   /* This will be filled when the driver will have hibernation support */
return (0);
 }
 
@@ -1533,7 +1531,7 @@ mrsas_isr(void *arg)
  * perform the appropriate action.  Before we return, we clear the response
  * interrupt.
  */
-static int
+int
 mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex)
 {
Mpi2ReplyDescriptorsUnion_t *desc;
@@ -3020,7 +3018,6 @@ mrsas_reset_ctrl(struct mrsas_softc *sc,
device_printf(sc->mrsas_dev, "Get LD lsit 
failed from OCR.\n"
"Will get the latest LD LIST after OCR on 
event.\n");
}
-
mrsas_clear_bit(MRSAS_FUSION_IN_RESET, 
>reset_flags);
mrsas_enable_intr(sc);
sc->adprecovery = MRSAS_HBA_OPERATIONAL;

Modified: head/sys/dev/mrsas/mrsas_cam.c
==
--- head/sys/dev/mrsas/mrsas_cam.c  Fri May 13 12:18:12 2016
(r299670)
+++ head/sys/dev/mrsas/mrsas_cam.c  Fri May 13 12:21:50 2016
(r299671)
@@ -124,6 +124,7 @@ mrsas_get_updated_dev_handle(struct mrsa
 extern u_int8_t
 megasas_get_best_arm(PLD_LOAD_BALANCE_INFO lbInfo, u_int8_t arm,
 u_int64_t block, u_int32_t count);
+extern int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
 
 
 /*
@@ -648,7 +649,10 @@ mrsas_get_mpt_cmd(struct mrsas_softc *sc
if (!TAILQ_EMPTY(>mrsas_mpt_cmd_list_head)) {
cmd = TAILQ_FIRST(>mrsas_mpt_cmd_list_head);
TAILQ_REMOVE(>mrsas_mpt_cmd_list_head, cmd, next);
+   } else {
+   goto out;
}
+
memset((uint8_t *)cmd->io_request, 0, 
MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE);
cmd->data = NULL;
cmd->length = 0;
@@ -656,8 +660,9 @@ mrsas_get_mpt_cmd(struct mrsas_softc *sc
cmd->error_code = 0;
cmd->load_balance = 0;
cmd->ccb_ptr = NULL;
-   mtx_unlock(>mpt_cmd_pool_lock);
 
+out:
+   mtx_unlock(>mpt_cmd_pool_lock);
return cmd;
 }
 
@@ -1296,9 +1301,16 @@ mrsas_cmd_done(struct mrsas_softc *sc, s
 static void
 mrsas_cam_poll(struct cam_sim *sim)
 {
+   int i;
struct mrsas_softc *sc = (struct mrsas_softc *)cam_sim_softc(sim);
 
-   mrsas_isr((void *)sc);
+   if (sc->msix_vectors != 0){
+

svn commit: r299670 - head/sys/dev/mrsas

2016-05-13 Thread Kashyap D Desai
Author: kadesai
Date: Fri May 13 12:18:12 2016
New Revision: 299670
URL: https://svnweb.freebsd.org/changeset/base/299670

Log:
  Added supprot for Avago Intruder controller.
  
  Submitted by:   Sumit Saxena 
  Reviewed by:Kashyap Desai 
  MFC after:  3 days
  Sponsored by:   AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/mrsas/mrsas_fp.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Fri May 13 12:15:20 2016(r299669)
+++ head/sys/dev/mrsas/mrsas.c  Fri May 13 12:18:12 2016(r299670)
@@ -186,6 +186,8 @@ MRSAS_CTLR_ID device_table[] = {
{0x1000, MRSAS_TBOLT, 0x, 0x, "AVAGO Thunderbolt SAS 
Controller"},
{0x1000, MRSAS_INVADER, 0x, 0x, "AVAGO Invader SAS Controller"},
{0x1000, MRSAS_FURY, 0x, 0x, "AVAGO Fury SAS Controller"},
+   {0x1000, MRSAS_INTRUDER, 0x, 0x, "AVAGO Intruder SAS 
Controller"},
+   {0x1000, MRSAS_INTRUDER_24, 0x, 0x, "AVAGO Intruder_24 SAS 
Controller"},
{0, 0, 0, 0, NULL}
 };
 
@@ -1628,7 +1630,9 @@ mrsas_complete_cmd(struct mrsas_softc *s
if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) {
if (sc->msix_enable) {
if ((sc->device_id == MRSAS_INVADER) ||
-   (sc->device_id == MRSAS_FURY))
+   (sc->device_id == MRSAS_FURY) ||
+   (sc->device_id == MRSAS_INTRUDER) ||
+   (sc->device_id == MRSAS_INTRUDER_24))
mrsas_write_reg(sc, 
sc->msix_reg_offset[MSIxIndex / 8],
((MSIxIndex & 0x7) << 24) |
sc->last_reply_idx[MSIxIndex]);
@@ -1650,7 +1654,9 @@ mrsas_complete_cmd(struct mrsas_softc *s
/* Clear response interrupt */
if (sc->msix_enable) {
if ((sc->device_id == MRSAS_INVADER) ||
-   (sc->device_id == MRSAS_FURY)) {
+   (sc->device_id == MRSAS_FURY) ||
+   (sc->device_id == MRSAS_INTRUDER) ||
+   (sc->device_id == MRSAS_INTRUDER_24)) {
mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex / 8],
((MSIxIndex & 0x7) << 24) |
sc->last_reply_idx[MSIxIndex]);
@@ -2449,7 +2455,9 @@ mrsas_ioc_init(struct mrsas_softc *sc)
 
/* driver support Extended MSIX */
if ((sc->device_id == MRSAS_INVADER) ||
-   (sc->device_id == MRSAS_FURY)) {
+   (sc->device_id == MRSAS_FURY) ||
+   (sc->device_id == MRSAS_INTRUDER) ||
+   (sc->device_id == MRSAS_INTRUDER_24)) {
init_frame->driver_operations.
mfi_capabilities.support_additional_msix = 1;
}
@@ -3483,7 +3491,10 @@ mrsas_build_mptmfi_passthru(struct mrsas
 
io_req = mpt_cmd->io_request;
 
-   if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) {
+   if ((sc->device_id == MRSAS_INVADER) ||
+   (sc->device_id == MRSAS_FURY) ||
+   (sc->device_id == MRSAS_INTRUDER) ||
+   (sc->device_id == MRSAS_INTRUDER_24)) {
pMpi25IeeeSgeChain64_t sgl_ptr_end = 
(pMpi25IeeeSgeChain64_t)_req->SGL;
 
sgl_ptr_end += sc->max_sge_in_main_msg - 1;

Modified: head/sys/dev/mrsas/mrsas.h
==
--- head/sys/dev/mrsas/mrsas.h  Fri May 13 12:15:20 2016(r299669)
+++ head/sys/dev/mrsas/mrsas.h  Fri May 13 12:18:12 2016(r299670)
@@ -80,6 +80,8 @@ __FBSDID("$FreeBSD$");
 #defineMRSAS_TBOLT 0x005b
 #defineMRSAS_INVADER   0x005d
 #defineMRSAS_FURY  0x005f
+#defineMRSAS_INTRUDER  0x00ce
+#defineMRSAS_INTRUDER_24   0x00cf
 #defineMRSAS_PCI_BAR0  0x10
 #defineMRSAS_PCI_BAR1  0x14
 #defineMRSAS_PCI_BAR2  0x1C

Modified: head/sys/dev/mrsas/mrsas_cam.c
==
--- head/sys/dev/mrsas/mrsas_cam.c  Fri May 13 12:15:20 2016
(r299669)
+++ head/sys/dev/mrsas/mrsas_cam.c  Fri May 13 12:18:12 2016
(r299670)
@@ -872,7 +872,10 @@ mrsas_setup_io(struct mrsas_softc *sc, s
cmd->request_desc->SCSIIO.RequestFlags =
(MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY <<
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
-   if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == 
MRSAS_FURY)) {
+   if ((sc->device_id == 

svn commit: r299669 - head/sys/dev/mrsas

2016-05-13 Thread Kashyap D Desai
Author: kadesai
Date: Fri May 13 12:15:20 2016
New Revision: 299669
URL: https://svnweb.freebsd.org/changeset/base/299669

Log:
  Implemented interrupt Config Hook in mrsas(4) to defer some of the tasks, 
like:
  riegistering AEN, creating cdev.
  
  Submitted by:   Sumit Saxena 
  Reviewed by:Kashyap Desai 
  MFC after:  3 days
  Sponsored by:   AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Fri May 13 12:12:09 2016(r299668)
+++ head/sys/dev/mrsas/mrsas.c  Fri May 13 12:15:20 2016(r299669)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -63,6 +64,7 @@ static d_write_t mrsas_write;
 static d_ioctl_t mrsas_ioctl;
 static d_poll_t mrsas_poll;
 
+static void mrsas_ich_startup(void *arg);
 static struct mrsas_mgmt_info mrsas_mgmt_info;
 static struct mrsas_ident *mrsas_find_ident(device_t);
 static int mrsas_setup_msix(struct mrsas_softc *sc);
@@ -822,7 +824,6 @@ mrsas_attach(device_t dev)
 {
struct mrsas_softc *sc = device_get_softc(dev);
uint32_t cmd, bar, error;
-   struct cdev *linux_dev;
 
/* Look up our softc and initialize its fields. */
sc->mrsas_dev = dev;
@@ -863,12 +864,6 @@ mrsas_attach(device_t dev)
mtx_init(>mfi_cmd_pool_lock, "mrsas_mfi_cmd_pool_lock", NULL, 
MTX_DEF);
mtx_init(>raidmap_lock, "mrsas_raidmap_lock", NULL, MTX_DEF);
 
-   /*
-* Intialize a counting Semaphore to take care no. of concurrent
-* IOCTLs
-*/
-   sema_init(>ioctl_count_sema, MRSAS_MAX_MFI_CMDS - 5, 
IOCTL_SEMA_DESCRIPTION);
-
/* Intialize linked list */
TAILQ_INIT(>mrsas_mpt_cmd_list_head);
TAILQ_INIT(>mrsas_mfi_cmd_list_head);
@@ -877,16 +872,6 @@ mrsas_attach(device_t dev)
 
sc->io_cmds_highwater = 0;
 
-   /* Create a /dev entry for this device. */
-   sc->mrsas_cdev = make_dev(_cdevsw, device_get_unit(dev), UID_ROOT,
-   GID_OPERATOR, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP), "mrsas%u",
-   device_get_unit(dev));
-   if (device_get_unit(dev) == 0)
-   make_dev_alias_p(MAKEDEV_CHECKNAME, _dev, sc->mrsas_cdev,
-   "megaraid_sas_ioctl_node");
-   if (sc->mrsas_cdev)
-   sc->mrsas_cdev->si_drv1 = sc;
-
sc->adprecovery = MRSAS_HBA_OPERATIONAL;
sc->UnevenSpanSupport = 0;
 
@@ -896,7 +881,7 @@ mrsas_attach(device_t dev)
if (mrsas_init_fw(sc) != SUCCESS) {
goto attach_fail_fw;
}
-   /* Register SCSI mid-layer */
+   /* Register mrsas to CAM layer */
if ((mrsas_cam_attach(sc) != SUCCESS)) {
goto attach_fail_cam;
}
@@ -904,38 +889,28 @@ mrsas_attach(device_t dev)
if (mrsas_setup_irq(sc) != SUCCESS) {
goto attach_fail_irq;
}
-   /* Enable Interrupts */
-   mrsas_enable_intr(sc);
-
error = mrsas_kproc_create(mrsas_ocr_thread, sc,
>ocr_thread, 0, 0, "mrsas_ocr%d",
device_get_unit(sc->mrsas_dev));
if (error) {
-   printf("Error %d starting rescan thread\n", error);
-   goto attach_fail_irq;
-   }
-   mrsas_setup_sysctl(sc);
-
-   /* Initiate AEN (Asynchronous Event Notification) */
-
-   if (mrsas_start_aen(sc)) {
-   printf("Error: start aen failed\n");
-   goto fail_start_aen;
+   device_printf(sc->mrsas_dev, "Error %d starting OCR thread\n", 
error);
+   goto attach_fail_ocr_thread;
}
/*
-* Add this controller to mrsas_mgmt_info structure so that it can be
-* exported to management applications
+* After FW initialization and OCR thread creation
+* we will defer the cdev creation, AEN setup on ICH callback
 */
-   if (device_get_unit(dev) == 0)
-   memset(_mgmt_info, 0, sizeof(mrsas_mgmt_info));
-
-   mrsas_mgmt_info.count++;
-   mrsas_mgmt_info.sc_ptr[mrsas_mgmt_info.max_index] = sc;
-   mrsas_mgmt_info.max_index++;
-
-   return (0);
+   sc->mrsas_ich.ich_func = mrsas_ich_startup;
+   sc->mrsas_ich.ich_arg = sc;
+   if (config_intrhook_establish(>mrsas_ich) != 0) {
+   device_printf(sc->mrsas_dev, "Config hook is already 
established\n");
+   }
+   mrsas_setup_sysctl(sc);
+   return SUCCESS;
 
-fail_start_aen:
+attach_fail_ocr_thread:
+   if (sc->ocr_thread_active)
+   wakeup(>ocr_chan);
 attach_fail_irq:
mrsas_teardown_intr(sc);
 attach_fail_cam:
@@ -953,10 +928,7 @@ attach_fail_fw:
mtx_destroy(>mpt_cmd_pool_lock);
mtx_destroy(>mfi_cmd_pool_lock);
mtx_destroy(>raidmap_lock);
-   /* Destroy the 

svn commit: r299668 - head/sys/dev/mrsas

2016-05-13 Thread Kashyap D Desai
Author: kadesai
Date: Fri May 13 12:12:09 2016
New Revision: 299668
URL: https://svnweb.freebsd.org/changeset/base/299668

Log:
  This patch implements driver support for 1MB IO size.
  
  NOTE:
  The FreeBSD system currently restricts the MAX IO size to MAXPHYS which
  in turn is 128KB. We tested the 1MB IO by converting the MAXPHYS to 1MB.
  
  Following is the mail reference:
  http://lists.freebsd.org/pipermail/freebsd-scsi/2015-January/006568.html
  
  Submitted by:   Sumit Saxena 
  Reviewed by:Kashyap Desai 
  MFC after:  3 days
  Sponsored by:   AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Fri May 13 12:05:02 2016(r299667)
+++ head/sys/dev/mrsas/mrsas.c  Fri May 13 12:12:09 2016(r299668)
@@ -1703,9 +1703,9 @@ mrsas_alloc_mem(struct mrsas_softc *sc)
BUS_SPACE_MAXADDR,  /* lowaddr */
BUS_SPACE_MAXADDR,  /* highaddr */
NULL, NULL, /* filter, filterarg */
-   MRSAS_MAX_IO_SIZE,  /* maxsize */
-   MRSAS_MAX_SGL,  /* nsegments */
-   MRSAS_MAX_IO_SIZE,  /* maxsegsize */
+   MAXPHYS,/* maxsize */
+   sc->max_num_sge,/* nsegments */
+   MAXPHYS,/* maxsegsize */
0,  /* flags */
NULL, NULL, /* lockfunc, lockarg */
>mrsas_parent_tag   /* tag */
@@ -1902,9 +1902,9 @@ mrsas_alloc_mem(struct mrsas_softc *sc)
BUS_SPACE_MAXADDR,
BUS_SPACE_MAXADDR,
NULL, NULL,
-   MRSAS_MAX_IO_SIZE,
-   MRSAS_MAX_SGL,
-   MRSAS_MAX_IO_SIZE,
+   MAXPHYS,
+   sc->max_num_sge,/* nsegments */
+   MAXPHYS,
BUS_DMA_ALLOCNOW,
busdma_lock_mutex,
>io_lock,
@@ -2248,7 +2248,7 @@ int
 mrsas_init_adapter(struct mrsas_softc *sc)
 {
uint32_t status;
-   u_int32_t max_cmd;
+   u_int32_t max_cmd, scratch_pad_2;
int ret;
int i = 0;
 
@@ -2267,13 +2267,33 @@ mrsas_init_adapter(struct mrsas_softc *s
sc->request_alloc_sz = sizeof(MRSAS_REQUEST_DESCRIPTOR_UNION) * max_cmd;
sc->reply_alloc_sz = sizeof(MPI2_REPLY_DESCRIPTORS_UNION) * 
(sc->reply_q_depth);
sc->io_frames_alloc_sz = MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE + 
(MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE * (max_cmd + 1));
-   sc->chain_frames_alloc_sz = 1024 * max_cmd;
+   scratch_pad_2 = mrsas_read_reg(sc, offsetof(mrsas_reg_set,
+   outbound_scratch_pad_2));
+   /*
+* If scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK is set,
+* Firmware support extended IO chain frame which is 4 time more
+* than legacy Firmware. Legacy Firmware - Frame size is (8 * 128) =
+* 1K 1M IO Firmware  - Frame size is (8 * 128 * 4)  = 4K
+*/
+   if (scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK)
+   sc->max_chain_frame_sz =
+   ((scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_MASK) >> 5)
+   * MEGASAS_1MB_IO;
+   else
+   sc->max_chain_frame_sz =
+   ((scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_MASK) >> 5)
+   * MEGASAS_256K_IO;
+
+   sc->chain_frames_alloc_sz = sc->max_chain_frame_sz * max_cmd;
sc->max_sge_in_main_msg = (MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE -
offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL)) / 16;
 
-   sc->max_sge_in_chain = MRSAS_MAX_SZ_CHAIN_FRAME / 
sizeof(MPI2_SGE_IO_UNION);
+   sc->max_sge_in_chain = sc->max_chain_frame_sz / 
sizeof(MPI2_SGE_IO_UNION);
sc->max_num_sge = sc->max_sge_in_main_msg + sc->max_sge_in_chain - 2;
 
+   mrsas_dprint(sc, MRSAS_INFO, "Avago Debug: MAX sge 0x%X MAX chain frame 
size 0x%X \n",
+   sc->max_num_sge, sc->max_chain_frame_sz);
+
/* Used for pass thru MFI frame (DCMD) */
sc->chain_offset_mfi_pthru = offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL) 
/ 16;
 
@@ -2411,6 +2431,8 @@ mrsas_ioc_init(struct mrsas_softc *sc)
init_frame->driver_operations.mfi_capabilities.support_ndrive_r1_lb = 1;
init_frame->driver_operations.mfi_capabilities.support_max_255lds = 1;

init_frame->driver_operations.mfi_capabilities.security_protocol_cmds_fw = 1;
+   if (sc->max_chain_frame_sz > MEGASAS_CHAIN_FRAME_SZ_MIN)
+   
init_frame->driver_operations.mfi_capabilities.support_ext_io_size = 1;
phys_addr = (bus_addr_t)sc->ioc_init_phys_mem + 1024;
init_frame->queue_info_new_phys_addr_lo = phys_addr;
init_frame->data_xfer_len = sizeof(Mpi2IOCInitRequest_t);
@@ -2513,7 +2535,7 @@ 

svn commit: r299667 - head/sys/dev/mrsas

2016-05-13 Thread Kashyap D Desai
Author: kadesai
Date: Fri May 13 12:05:02 2016
New Revision: 299667
URL: https://svnweb.freebsd.org/changeset/base/299667

Log:
  Similar to RAID map for Logical Drives, now JBOD map has been introduced for
  JBODs. Driver has to sync the JBOD map with firmware and use sequence number
  as a reference for JBOD FastPath I/O's.
  
  Submitted by:   Sumit Saxena 
  Reviewed by:Kashyap Desai 
  MFC after:  3 days
  Sponsored by:   AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Fri May 13 12:00:46 2016(r299666)
+++ head/sys/dev/mrsas/mrsas.c  Fri May 13 12:05:02 2016(r299667)
@@ -80,6 +80,8 @@ static int mrsas_setup_irq(struct mrsas_
 static int mrsas_alloc_mem(struct mrsas_softc *sc);
 static int mrsas_init_fw(struct mrsas_softc *sc);
 static int mrsas_setup_raidmap(struct mrsas_softc *sc);
+static void megasas_setup_jbod_map(struct mrsas_softc *sc);
+static int megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend);
 static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
 static int mrsas_clear_intr(struct mrsas_softc *sc);
 static int mrsas_get_ctrl_info(struct mrsas_softc *sc);
@@ -1076,7 +1078,14 @@ mrsas_free_mem(struct mrsas_softc *sc)
if (sc->ld_drv_map[i] != NULL)
free(sc->ld_drv_map[i], M_MRSAS);
}
-
+   for (i = 0; i < 2; i++) {
+   if (sc->jbodmap_phys_addr[i])
+   bus_dmamap_unload(sc->jbodmap_tag[i], 
sc->jbodmap_dmamap[i]);
+   if (sc->jbodmap_mem[i] != NULL)
+   bus_dmamem_free(sc->jbodmap_tag[i], sc->jbodmap_mem[i], 
sc->jbodmap_dmamap[i]);
+   if (sc->jbodmap_tag[i] != NULL)
+   bus_dma_tag_destroy(sc->jbodmap_tag[i]);
+   }
/*
 * Free version buffer memory
 */
@@ -1997,6 +2006,78 @@ ABORT:
return (1);
 }
 
+/**
+ * megasas_setup_jbod_map -setup jbod map for FP seq_number.
+ * @sc:Adapter soft state
+ *
+ * Return 0 on success.
+ */
+void
+megasas_setup_jbod_map(struct mrsas_softc *sc)
+{
+   int i;
+   uint32_t pd_seq_map_sz;
+
+   pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
+   (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1));
+
+   if (!sc->ctrl_info->adapterOperations3.useSeqNumJbodFP) {
+   sc->use_seqnum_jbod_fp = 0;
+   return;
+   }
+   if (sc->jbodmap_mem[0])
+   goto skip_alloc;
+
+   for (i = 0; i < 2; i++) {
+   if (bus_dma_tag_create(sc->mrsas_parent_tag,
+   4, 0,
+   BUS_SPACE_MAXADDR_32BIT,
+   BUS_SPACE_MAXADDR,
+   NULL, NULL,
+   pd_seq_map_sz,
+   1,
+   pd_seq_map_sz,
+   BUS_DMA_ALLOCNOW,
+   NULL, NULL,
+   >jbodmap_tag[i])) {
+   device_printf(sc->mrsas_dev,
+   "Cannot allocate jbod map tag.\n");
+   return;
+   }
+   if (bus_dmamem_alloc(sc->jbodmap_tag[i],
+   (void **)>jbodmap_mem[i],
+   BUS_DMA_NOWAIT, >jbodmap_dmamap[i])) {
+   device_printf(sc->mrsas_dev,
+   "Cannot allocate jbod map memory.\n");
+   return;
+   }
+   bzero(sc->jbodmap_mem[i], pd_seq_map_sz);
+
+   if (bus_dmamap_load(sc->jbodmap_tag[i], sc->jbodmap_dmamap[i],
+   sc->jbodmap_mem[i], pd_seq_map_sz,
+   mrsas_addr_cb, >jbodmap_phys_addr[i],
+   BUS_DMA_NOWAIT)) {
+   device_printf(sc->mrsas_dev, "Cannot load jbod map 
memory.\n");
+   return;
+   }
+   if (!sc->jbodmap_mem[i]) {
+   device_printf(sc->mrsas_dev,
+   "Cannot allocate memory for jbod map.\n");
+   sc->use_seqnum_jbod_fp = 0;
+   return;
+   }
+   }
+
+skip_alloc:
+   if (!megasas_sync_pd_seq_num(sc, false) &&
+   !megasas_sync_pd_seq_num(sc, true))
+   sc->use_seqnum_jbod_fp = 1;
+   else
+   sc->use_seqnum_jbod_fp = 0;
+
+   device_printf(sc->mrsas_dev, "Jbod map is supported\n");
+}
+
 /*
  * mrsas_init_fw:  Initialize Firmware
  * input:  Adapter soft state
@@ -2096,18 +2177,28 @@ mrsas_init_fw(struct mrsas_softc *sc)
if (sc->secure_jbod_support)
device_printf(sc->mrsas_dev, "FW supports SED \n");
 
+   if 

svn commit: r299666 - head/sys/dev/mrsas

2016-05-13 Thread Kashyap D Desai
Author: kadesai
Date: Fri May 13 12:00:46 2016
New Revision: 299666
URL: https://svnweb.freebsd.org/changeset/base/299666

Log:
  There was no ERROR handling for firmware command TIMEOUT. This patch
  takes care of any firmware command timeout scenarios by initiating OCR.
  
  Submitted by:   Sumit Saxena 
  Reviewed by:Kashyap Desai 
  MFC after:  3 days
  Sponsored by:   AVAGO Technologies

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/mrsas/mrsas_ioctl.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Fri May 13 11:51:43 2016(r299665)
+++ head/sys/dev/mrsas/mrsas.c  Fri May 13 12:00:46 2016(r299666)
@@ -104,8 +104,8 @@ int mrsas_ioc_init(struct mrsas_softc *s
 intmrsas_bus_scan(struct mrsas_softc *sc);
 intmrsas_issue_dcmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
 intmrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
-intmrsas_reset_ctrl(struct mrsas_softc *sc);
-intmrsas_wait_for_outstanding(struct mrsas_softc *sc);
+intmrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason);
+intmrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t 
check_reason);
 int
 mrsas_issue_blocked_cmd(struct mrsas_softc *sc,
 struct mrsas_mfi_cmd *cmd);
@@ -553,6 +553,7 @@ mrsas_get_seq_num(struct mrsas_softc *sc
 {
struct mrsas_mfi_cmd *cmd;
struct mrsas_dcmd_frame *dcmd;
+   u_int8_t do_ocr = 1, retcode = 0;
 
cmd = mrsas_get_mfi_cmd(sc);
 
@@ -580,16 +581,24 @@ mrsas_get_seq_num(struct mrsas_softc *sc
dcmd->sgl.sge32[0].phys_addr = sc->el_info_phys_addr;
dcmd->sgl.sge32[0].length = sizeof(struct mrsas_evt_log_info);
 
-   mrsas_issue_blocked_cmd(sc, cmd);
+   retcode = mrsas_issue_blocked_cmd(sc, cmd);
+   if (retcode == ETIMEDOUT)
+   goto dcmd_timeout;
 
+   do_ocr = 0;
/*
 * Copy the data back into callers buffer
 */
memcpy(eli, sc->el_info_mem, sizeof(struct mrsas_evt_log_info));
mrsas_free_evt_log_info_cmd(sc);
-   mrsas_release_mfi_cmd(cmd);
 
-   return 0;
+dcmd_timeout:
+   if (do_ocr)
+   sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
+   else
+   mrsas_release_mfi_cmd(cmd);
+
+   return retcode;
 }
 
 
@@ -991,7 +1000,7 @@ mrsas_detach(device_t dev)
i++;
if (!(i % MRSAS_RESET_NOTICE_INTERVAL)) {
mrsas_dprint(sc, MRSAS_INFO,
-   "[%2d]waiting for ocr to be finished\n", i);
+   "[%2d]waiting for OCR to be finished from %s\n", i, 
__func__);
}
pause("mr_shutdown", hz);
}
@@ -1318,9 +1327,7 @@ mrsas_ioctl(struct cdev *dev, u_long cmd
i++;
if (!(i % MRSAS_RESET_NOTICE_INTERVAL)) {
mrsas_dprint(sc, MRSAS_INFO,
-   "[%2d]waiting for "
-   "OCR to be finished %d\n", i,
-   sc->ocr_thread_active);
+   "[%2d]waiting for OCR to be finished from %s\n", i, 
__func__);
}
pause("mr_ioctl", hz);
}
@@ -2626,16 +2633,20 @@ mrsas_ocr_thread(void *arg)
/* Sleep for 1 second and check the queue status */
msleep(>ocr_chan, >sim_lock, PRIBIO,
"mrsas_ocr", sc->mrsas_fw_fault_check_delay * hz);
-   if (sc->remove_in_progress) {
+   if (sc->remove_in_progress ||
+   sc->adprecovery == MRSAS_HW_CRITICAL_ERROR) {
mrsas_dprint(sc, MRSAS_OCR,
-   "Exit due to shutdown from %s\n", __func__);
+   "Exit due to %s from %s\n",
+   sc->remove_in_progress ? "Shutdown" :
+   "Hardware critical error", __func__);
break;
}
fw_status = mrsas_read_reg(sc,
offsetof(mrsas_reg_set, outbound_scratch_pad));
fw_state = fw_status & MFI_STATE_MASK;
if (fw_state == MFI_STATE_FAULT || sc->do_timedout_reset) {
-   device_printf(sc->mrsas_dev, "OCR started due to %s!\n",
+   device_printf(sc->mrsas_dev, "%s started due to %s!\n",
+   sc->disableOnlineCtrlReset ? "Kill Adapter" : "OCR",
sc->do_timedout_reset ? "IO Timeout" :
"FW fault detected");
mtx_lock_spin(>ioctl_lock);
@@ -2643,7 +2654,7 @@ mrsas_ocr_thread(void *arg)
sc->reset_count++;

svn commit: r299665 - head/sys/compat/linuxkpi/common/include/linux

2016-05-13 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 13 11:51:43 2016
New Revision: 299665
URL: https://svnweb.freebsd.org/changeset/base/299665

Log:
  Implement "old_encode_dev()" for the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kdev_t.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kdev_t.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kdev_t.h  Fri May 13 
11:42:36 2016(r299664)
+++ head/sys/compat/linuxkpi/common/include/linux/kdev_t.h  Fri May 13 
11:51:43 2016(r299665)
@@ -35,4 +35,10 @@
 #define MINOR(dev)  minor((dev))
 #define MKDEV(ma, mi)   makedev((ma), (mi))
 
+static inline uint16_t
+old_encode_dev(dev_t dev)
+{
+   return ((MAJOR(dev) << 8) | MINOR(dev));
+}
+
 #endif /* _LINUX_KDEV_T_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299664 - head/sys/compat/linuxkpi/common/include/linux

2016-05-13 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 13 11:42:36 2016
New Revision: 299664
URL: https://svnweb.freebsd.org/changeset/base/299664

Log:
  Define _IOC_SIZE() in the LinuxKPI.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/ioctl.h

Modified: head/sys/compat/linuxkpi/common/include/linux/ioctl.h
==
--- head/sys/compat/linuxkpi/common/include/linux/ioctl.h   Fri May 13 
11:30:56 2016(r299663)
+++ head/sys/compat/linuxkpi/common/include/linux/ioctl.h   Fri May 13 
11:42:36 2016(r299664)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,4 +33,6 @@
 
 #include 
 
+#define_IOC_SIZE(cmd) IOCPARM_LEN(cmd)
+
 #endif /* _LINUX_IOCTL_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299663 - head/sys/compat/linuxkpi/common/include/linux

2016-05-13 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 13 11:30:56 2016
New Revision: 299663
URL: https://svnweb.freebsd.org/changeset/base/299663

Log:
  Add unlikely() statement to optimise the IS_ERR_VALUE() macro.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/err.h

Modified: head/sys/compat/linuxkpi/common/include/linux/err.h
==
--- head/sys/compat/linuxkpi/common/include/linux/err.h Fri May 13 11:27:49 
2016(r299662)
+++ head/sys/compat/linuxkpi/common/include/linux/err.h Fri May 13 11:30:56 
2016(r299663)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,9 +31,11 @@
 #ifndef_LINUX_ERR_H_
 #define_LINUX_ERR_H_
 
+#include 
+
 #define MAX_ERRNO  4095
 
-#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
+#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
 
 static inline void *
 ERR_PTR(long error)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299662 - head/sys/boot/geli

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 11:27:49 2016
New Revision: 299662
URL: https://svnweb.freebsd.org/changeset/base/299662

Log:
  Fix a -Wformat warning by using %d, not %ld for md_iterations
  
  md_iterations is int32_t, not long.
  
  Reported by: clang
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/boot/geli/geliboot.c

Modified: head/sys/boot/geli/geliboot.c
==
--- head/sys/boot/geli/geliboot.c   Fri May 13 11:24:55 2016
(r299661)
+++ head/sys/boot/geli/geliboot.c   Fri May 13 11:27:49 2016
(r299662)
@@ -155,7 +155,7 @@ geli_attach(struct dsk *dskp, const char
g_eli_crypto_hmac_update(, passphrase,
strlen(passphrase));
} else if (geli_e->md.md_iterations > 0) {
-   printf("Calculating GELI Decryption Key disk%dp%d @ %lu"
+   printf("Calculating GELI Decryption Key disk%dp%d @ %d"
" iterations...\n", dskp->unit,
(dskp->slice > 0 ? dskp->slice : dskp->part),
geli_e->md.md_iterations);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299661 - head/sys/boot/geli

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 11:24:55 2016
New Revision: 299661
URL: https://svnweb.freebsd.org/changeset/base/299661

Log:
  Add geliboot_crypt(..) definition to geliboot.h to mute a 
-Wimplicit-function-declaration
  warning
  
  Reported by: clang
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/boot/geli/geliboot.h

Modified: head/sys/boot/geli/geliboot.h
==
--- head/sys/boot/geli/geliboot.h   Fri May 13 11:20:21 2016
(r299660)
+++ head/sys/boot/geli/geliboot.h   Fri May 13 11:24:55 2016
(r299661)
@@ -86,4 +86,7 @@ int geli_decrypt(u_int algo, u_char *dat
 const u_char *key, size_t keysize, const uint8_t* iv);
 int geli_passphrase(char *pw, int disk, int parttype, int part, struct dsk 
*dskp);
 
+int geliboot_crypt(u_int algo, int enc, u_char *data, size_t datasize,
+const u_char *key, size_t keysize, u_char *iv);
+
 #endif /* _GELIBOOT_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299660 - head/sys/boot/i386/zfsboot

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 11:20:21 2016
New Revision: 299660
URL: https://svnweb.freebsd.org/changeset/base/299660

Log:
  Put slba and elba under LOADER_GELI_SUPPORT ifdef to mute warning about them 
being
  unused in the non-GELI case
  
  MFC after: 1 week
  Reported by: clang
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/boot/i386/zfsboot/zfsboot.c

Modified: head/sys/boot/i386/zfsboot/zfsboot.c
==
--- head/sys/boot/i386/zfsboot/zfsboot.cFri May 13 11:18:29 2016
(r299659)
+++ head/sys/boot/i386/zfsboot/zfsboot.cFri May 13 11:20:21 2016
(r299660)
@@ -398,7 +398,9 @@ probe_drive(struct dsk *dsk)
 struct gpt_ent *ent;
 unsigned part, entries_per_sec;
 #endif
+#ifdef LOADER_GELI_SUPPORT
 daddr_t slba, elba;
+#endif
 struct dos_partition *dp;
 char *sec;
 unsigned i;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299659 - head/sys/boot/i386/zfsboot

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 11:18:29 2016
New Revision: 299659
URL: https://svnweb.freebsd.org/changeset/base/299659

Log:
  Remove unused const variable
  
  MFC after: 1 week
  Reported by: clang
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/boot/i386/zfsboot/zfsboot.c

Modified: head/sys/boot/i386/zfsboot/zfsboot.c
==
--- head/sys/boot/i386/zfsboot/zfsboot.cFri May 13 11:18:27 2016
(r299658)
+++ head/sys/boot/i386/zfsboot/zfsboot.cFri May 13 11:18:29 2016
(r299659)
@@ -85,7 +85,6 @@ static const unsigned char flags[NOPT] =
 };
 uint32_t opts;
 
-static const char *const dev_nm[NDEV] = {"ad", "da", "fd"};
 static const unsigned char dev_maj[NDEV] = {30, 4, 2};
 
 static char cmd[512];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299658 - head/sys/dev/pci

2016-05-13 Thread Bjoern A. Zeeb
Author: bz
Date: Fri May 13 11:18:27 2016
New Revision: 299658
URL: https://svnweb.freebsd.org/changeset/base/299658

Log:
  When using IOPORT with pci_host_generic we are missing setting the rman_end()
  which leads to end being before start and thus a signed extended very large
  number of size later on, which kva_alloc() will fail upon and we will panic.
  Add the missing call.
  
  Debugged with:andrew
  Reviewed by:  br, andrew
  Sponsored by: DARPA/AFRL
  Found:while using virtio with gem5
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D6337

Modified:
  head/sys/dev/pci/pci_host_generic.c

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Fri May 13 11:15:33 2016
(r299657)
+++ head/sys/dev/pci/pci_host_generic.c Fri May 13 11:18:27 2016
(r299658)
@@ -613,6 +613,7 @@ generic_pcie_activate_resource(device_t 
}
if (found) {
rman_set_start(r, rman_get_start(r) + phys_base);
+   rman_set_end(r, rman_get_end(r) + phys_base);
BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child,
type, rid, r);
} else {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299657 - head/sys/cddl/boot/zfs

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 11:15:33 2016
New Revision: 299657
URL: https://svnweb.freebsd.org/changeset/base/299657

Log:
  Include arpa/inet.h to get the htonl(3) definition
  
  MFC after: 2 weeks
  Reported by: clang
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/cddl/boot/zfs/lz4.c

Modified: head/sys/cddl/boot/zfs/lz4.c
==
--- head/sys/cddl/boot/zfs/lz4.cFri May 13 11:02:02 2016
(r299656)
+++ head/sys/cddl/boot/zfs/lz4.cFri May 13 11:15:33 2016
(r299657)
@@ -34,6 +34,8 @@
  * $FreeBSD$
  */
 
+#include 
+
 static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
int isize, int maxOutputSize);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299656 - head/sys/compat/linuxkpi/common/include/linux

2016-05-13 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 13 11:02:02 2016
New Revision: 299656
URL: https://svnweb.freebsd.org/changeset/base/299656

Log:
  Implement nsecs_to_jiffies() in the LinuxKPI and while at it
  streamline the rest of the xxx_to_jiffies() functions to have a
  constant 64-bit argument and use identical range checks for the
  result.
  
  Specifically preserve msecs_to_jiffies(0) returning 0. See r282743 for
  further details.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/jiffies.h

Modified: head/sys/compat/linuxkpi/common/include/linux/jiffies.h
==
--- head/sys/compat/linuxkpi/common/include/linux/jiffies.h Fri May 13 
10:59:46 2016(r299655)
+++ head/sys/compat/linuxkpi/common/include/linux/jiffies.h Fri May 13 
11:02:02 2016(r299656)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -39,16 +39,6 @@
 #include 
 #include 
 
-static inline int
-msecs_to_jiffies(int msec)
-{
-   struct timeval tv;
-
-   tv.tv_sec = msec / 1000;
-   tv.tv_usec = (msec % 1000) * 1000;
-   return (tvtohz() - 1);
-}
-
 #define jiffies ticks
 #definejiffies_64  ticks
 #define jiffies_to_msecs(x) (((int64_t)(x)) * 1000 / hz)
@@ -78,17 +68,35 @@ timespec_to_jiffies(const struct timespe
 }
 
 static inline int
-usecs_to_jiffies(const unsigned int u)
+msecs_to_jiffies(const u64 msec)
 {
u64 result;
 
-   result = ((u64)u * hz + 100 - 1) / 100;
+   result = howmany(msec * (u64)hz, 1000ULL);
if (result > MAX_JIFFY_OFFSET)
result = MAX_JIFFY_OFFSET;
 
return ((int)result);
 }
 
+static inline int
+usecs_to_jiffies(const u64 u)
+{
+   u64 result;
+
+   result = howmany(u * (u64)hz, 100ULL);
+   if (result > MAX_JIFFY_OFFSET)
+   result = MAX_JIFFY_OFFSET;
+
+   return ((int)result);
+}
+
+static inline u64
+nsecs_to_jiffies(const u64 n)
+{
+   return (usecs_to_jiffies(howmany(n, 1000ULL)));
+}
+
 static inline u64
 get_jiffies_64(void)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299655 - head/sys/boot/i386/common

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 10:59:46 2016
New Revision: 299655
URL: https://svnweb.freebsd.org/changeset/base/299655

Log:
  Add missing prototype for getchar(..)
  
  MFC after: 1 week
  Reported by: clang
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/boot/i386/common/cons.h

Modified: head/sys/boot/i386/common/cons.h
==
--- head/sys/boot/i386/common/cons.hFri May 13 10:52:02 2016
(r299654)
+++ head/sys/boot/i386/common/cons.hFri May 13 10:59:46 2016
(r299655)
@@ -28,6 +28,7 @@ void xputc(int c);
 void putchar(int c);
 int getc(int fn);
 int xgetc(int fn);
+int getchar(void);
 int keyhit(unsigned int secs);
 void getstr(char *cmdstr, size_t cmdstrsize);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299654 - head/lib/libc/tests/nss

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 10:52:02 2016
New Revision: 299654
URL: https://svnweb.freebsd.org/changeset/base/299654

Log:
  Read the contents of the snapshot files properly
  
  - Use fgetln instead of fgets; localize complexity related to fgetln(3)
inside the loop.
  - Skip over blank lines.
  - Skip over lines (properly) that start with a "#"
  
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/lib/libc/tests/nss/testutil.h

Modified: head/lib/libc/tests/nss/testutil.h
==
--- head/lib/libc/tests/nss/testutil.h  Fri May 13 10:10:43 2016
(r299653)
+++ head/lib/libc/tests/nss/testutil.h  Fri May 13 10:52:02 2016
(r299654)
@@ -252,9 +252,7 @@ int 
\
 __##ent##_snapshot_read(char const *fname, struct ent##_test_data *td, \
int (*read_func)(struct ent *, char *)) \
 {  \
-   char buffer[1024];  \
struct ent data;\
-   char *s;\
FILE *fi;   \
size_t len; \
int rv; \
@@ -267,23 +265,22 @@ __##ent##_snapshot_read(char const *fnam
return (-1);\
\
rv = 0; \
-   memset(buffer, 0, sizeof(buffer));  \
while (!feof(fi)) { \
-   s = fgets(buffer, sizeof(buffer), fi);  \
-   if (s != NULL && s[0] != '#') { \
-   len = strlen(s);\
-   if (len == 0)   \
-   continue;   \
-   if (buffer[len - 1] == '\n')\
-   buffer[len -1] = '\0';  \
-   \
-   rv = read_func(, s);   \
-   if (rv == 0) {  \
-   __##ent##_test_data_append(td, );  \
-   td->free_func();   \
-   } else  \
-   goto fin;   \
-   }   \
+   char *buf = fgetln(fi, );   \
+   if (buf == NULL || len <= 1)\
+   continue;   \
+   if (buf[len - 1] == '\n')   \
+   buf[len - 1] = '\0';\
+   else\
+   buf[len] = '\0';\
+   if (buf[0] == '#')  \
+   continue;   \
+   rv = read_func(, buf); \
+   if (rv == 0) {  \
+   __##ent##_test_data_append(td, );  \
+   td->free_func();   \
+   } else  \
+   goto fin;   \
}   \
\
 fin:   \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299653 - head/sys/compat/linuxkpi/common/include/linux

2016-05-13 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 13 10:10:43 2016
New Revision: 299653
URL: https://svnweb.freebsd.org/changeset/base/299653

Log:
  Add more Linux defines. Improve some existing ones.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/compiler.h
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h
==
--- head/sys/compat/linuxkpi/common/include/linux/compiler.hFri May 13 
09:54:15 2016(r299652)
+++ head/sys/compat/linuxkpi/common/include/linux/compiler.hFri May 13 
10:10:43 2016(r299653)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * Copyright (c) 2015 François Tigeot
  * All rights reserved.
  *
@@ -50,14 +50,17 @@
 #define __cond_lock(x,c)   (c)
 #define__bitwise
 #define __devinitdata
+#define__deprecated
 #define __init
 #define__devinit
 #define__devexit
 #define __exit
+#define__rcu
 #define__stringify(x)  #x
 #define__attribute_const__ __attribute__((__const__))
 #undef __always_inline
 #define__always_inline inline
+#definecacheline_aligned   __aligned(CACHE_LINE_SIZE)
 
 #definelikely(x)   __builtin_expect(!!(x), 1)
 #defineunlikely(x) __builtin_expect(!!(x), 0)
@@ -72,6 +75,9 @@
 
 #definebarrier()   __asm__ __volatile__("": : 
:"memory")
 
+#define___PASTE(a,b) a##b
+#define__PASTE(a,b) ___PASTE(a,b)
+
 #defineACCESS_ONCE(x)  (*(volatile __typeof(x) *)&(x))
   
 #defineWRITE_ONCE(x,v) do {\
@@ -87,5 +93,9 @@
barrier();  \
__var;  \
 })
-  
+
+#definelockless_dereference(p) READ_ONCE(p)
+
+#define_AT(T,X)((T)(X))
+
 #endif /* _LINUX_COMPILER_H_ */

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Fri May 13 
09:54:15 2016(r299652)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Fri May 13 
10:10:43 2016(r299653)
@@ -62,11 +62,59 @@
 #defineKERN_INFO   "<6>"
 #defineKERN_DEBUG  "<7>"
 
+#defineU8_MAX  ((u8)~0U)
+#defineS8_MAX  ((s8)(U8_MAX >> 1))
+#defineS8_MIN  ((s8)(-S8_MAX - 1))
+#defineU16_MAX ((u16)~0U)
+#defineS16_MAX ((s16)(U16_MAX >> 1))
+#defineS16_MIN ((s16)(-S16_MAX - 1))
+#defineU32_MAX ((u32)~0U)
+#defineS32_MAX ((s32)(U32_MAX >> 1))
+#defineS32_MIN ((s32)(-S32_MAX - 1))
+#defineU64_MAX ((u64)~0ULL)
+#defineS64_MAX ((s64)(U64_MAX >> 1))
+#defineS64_MIN ((s64)(-S64_MAX - 1))
+
+#defineS8_C(x)  x
+#defineU8_C(x)  x ## U
+#defineS16_C(x) x
+#defineU16_C(x) x ## U
+#defineS32_C(x) x
+#defineU32_C(x) x ## U
+#defineS64_C(x) x ## LL
+#defineU64_C(x) x ## ULL
+
 #defineBUILD_BUG_ON(x) CTASSERT(!(x))
 
-#define BUG()  panic("BUG")
-#define BUG_ON(condition)  do { if (condition) BUG(); } while(0)
-#defineWARN_ON BUG_ON
+#defineBUG()   panic("BUG at %s:%d", __FILE__, 
__LINE__)
+#defineBUG_ON(cond)do {\
+   if (cond) { \
+   panic("BUG ON %s failed at %s:%d",  \
+   __stringify(cond), __FILE__, __LINE__); \
+   }   \
+} while (0)
+
+#defineWARN_ON(cond) ({\
+  bool __ret = (cond); \
+  if (__ret) { \
+   printf("WARNING %s failed at %s:%d\n",  \
+   __stringify(cond), __FILE__, __LINE__); \
+  }\
+  unlikely(__ret); \
+})
+
+#defineWARN_ON_SMP(cond)   WARN_ON(cond)
+
+#defineWARN_ON_ONCE(cond) ({   \
+  static bool __warn_on_once;  \
+  bool __ret = (cond); 

Re: svn commit: r299575 - head/sys/net80211

2016-05-13 Thread Andriy Voskoboinyk
Fri, 13 May 2016 02:56:56 +0300 було написано Adrian Chadd  
:


It works - but REFCNT_LOC macro is not used since r178354 (multi-vap  
support).



Wait a sec, I thought the DEBUG_REFCNT stuff worked?


-a


On 12 May 2016 at 15:17, Andriy Voskoboinyk  wrote:

Author: avos
Date: Thu May 12 22:17:00 2016
New Revision: 299575
URL: https://svnweb.freebsd.org/changeset/base/299575

Log:
  net80211: drop some unused variables / local macros

  Most of them left after some commits (r178354, r191544, r287197 etc.);
  some were never used.

  Found by: Clang Static Analyzer

Modified:
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_hwmp.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_phy.c
  head/sys/net80211/ieee80211_scan_sw.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_wds.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Thu May 12 22:13:12 2016 
(r299574)
+++ head/sys/net80211/ieee80211_adhoc.c Thu May 12 22:17:00 2016 
(r299575)

@@ -674,7 +674,7 @@ adhoc_recv_mgmt(struct ieee80211_node *n
struct ieee80211com *ic = ni->ni_ic;
struct ieee80211_channel *rxchan = ic->ic_curchan;
struct ieee80211_frame *wh;
-   uint8_t *frm, *efrm, *sfrm;
+   uint8_t *frm, *efrm;
uint8_t *ssid, *rates, *xrates;
 #if 0
int ht_state_change = 0;
@@ -809,7 +809,6 @@ adhoc_recv_mgmt(struct ieee80211_node *n
 *  [tlv] extended supported rates
 */
ssid = rates = xrates = NULL;
-   sfrm = frm;
while (efrm - frm > 1) {
IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2,  
return);

switch (*frm) {

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cThu May 12 22:13:12  
2016(r299574)
+++ head/sys/net80211/ieee80211_hostap.cThu May 12 22:17:00  
2016(r299575)

@@ -412,16 +412,8 @@ hostap_deliver_data(struct ieee80211vap
ieee80211_free_node(sta);
}
}
-   if (mcopy != NULL) {
-   int len, err;
-   len = mcopy->m_pkthdr.len;
-   err = ieee80211_vap_xmitpkt(vap, mcopy);
-   if (err) {
-   /* NB: IFQ_HANDOFF reclaims mcopy */
-   } else {
-   if_inc_counter(ifp, IFCOUNTER_OPACKETS,  
1);

-   }
-   }
+   if (mcopy != NULL && ieee80211_vap_xmitpkt(vap, mcopy)  
== 0)

+   if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
}
if (m != NULL) {
/*
@@ -1798,7 +1790,6 @@ hostap_recv_mgmt(struct ieee80211_node *
 *  [tlv] extended supported rates
 */
ssid = rates = xrates = NULL;
-   sfrm = frm;
while (efrm - frm > 1) {
IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2,  
return);

switch (*frm) {

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu May 12 22:13:12 2016 
(r299574)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu May 12 22:17:00 2016 
(r299575)

@@ -128,7 +128,6 @@ typedef uint32_t ieee80211_hwmp_seq;
 #defineHWMP_SEQ_LEQ(a, b)  ((int32_t)((a)-(b)) <= 0)
 #defineHWMP_SEQ_EQ(a, b)   ((int32_t)((a)-(b)) == 0)
 #defineHWMP_SEQ_GT(a, b)   ((int32_t)((a)-(b)) > 0)
-#defineHWMP_SEQ_GEQ(a, b)  ((int32_t)((a)-(b)) >= 0)

 #define HWMP_SEQ_MAX(a, b) (a > b ? a : b)

@@ -1526,7 +1525,6 @@ hwmp_peerdown(struct ieee80211_node *ni)
 #definePERR_DADDR(n)   perr->perr_dests[n].dest_addr
 #definePERR_DSEQ(n)perr->perr_dests[n].dest_seq
 #definePERR_DEXTADDR(n) 
perr->perr_dests[n].dest_ext_addr

-#definePERR_DRCODE(n)  perr->perr_dests[n].dest_rcode
 static void
 hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_node *ni,
 const struct ieee80211_frame *wh, const struct  
ieee80211_meshperr_ie *perr)

@@ -1628,7 +1626,6 @@ done:
 #undef PERR_DADDR
 #undef PERR_DSEQ
 #undef PERR_DEXTADDR
-#undef PERR_DRCODE

 static int
 hwmp_send_perr(struct ieee80211vap *vap,
@@ -1737,7 +1734,6 @@ hwmp_recv_rann(struct ieee80211vap *vap,
struct ieee80211_hwmp_route *hr;
struct 

svn commit: r299652 - stable/9/lib/libkvm

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:54:15 2016
New Revision: 299652
URL: https://svnweb.freebsd.org/changeset/base/299652

Log:
  MFstable/10 r299651:
  
  MFC r298839:
  
  Fix memory allocation edgecases in kvm_argv(..)
  
  - Don't leak nbufp on realloc failure in kvm_argv
  - Catch malloc errors with bufp
  - Set buflen last in the "buflen == 0" case to ensure that
bufp/nbufp is properly reallocated on the next go around

Modified:
  stable/9/lib/libkvm/kvm_proc.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/lib/   (props changed)
  stable/9/lib/libkvm/   (props changed)

Modified: stable/9/lib/libkvm/kvm_proc.c
==
--- stable/9/lib/libkvm/kvm_proc.c  Fri May 13 09:52:39 2016
(r299651)
+++ stable/9/lib/libkvm/kvm_proc.c  Fri May 13 09:54:15 2016
(r299652)
@@ -642,6 +642,7 @@ kvm_argv(kvm_t *kd, const struct kinfo_p
static char *buf, *p;
static char **bufp;
static int argc;
+   char **nbufp;
 
if (!ISALIVE(kd)) {
_kvm_err(kd, kd->program,
@@ -657,9 +658,15 @@ kvm_argv(kvm_t *kd, const struct kinfo_p
_kvm_err(kd, kd->program, "cannot allocate memory");
return (0);
}
-   buflen = nchr;
argc = 32;
bufp = malloc(sizeof(char *) * argc);
+   if (bufp == NULL) {
+   free(buf);
+   buf = NULL;
+   _kvm_err(kd, kd->program, "cannot allocate memory");
+   return (NULL);
+   }
+   buflen = nchr;
} else if (nchr > buflen) {
p = realloc(buf, nchr);
if (p != NULL) {
@@ -693,8 +700,10 @@ kvm_argv(kvm_t *kd, const struct kinfo_p
p += strlen(p) + 1;
if (i >= argc) {
argc += argc;
-   bufp = realloc(bufp,
-   sizeof(char *) * argc);
+   nbufp = realloc(bufp, sizeof(char *) * argc);
+   if (nbufp == NULL)
+   return (NULL);
+   bufp = nbufp;
}
} while (p < buf + bufsz);
bufp[i++] = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299651 - stable/10/lib/libkvm

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:52:39 2016
New Revision: 299651
URL: https://svnweb.freebsd.org/changeset/base/299651

Log:
  MFC r298839:
  
  Fix memory allocation edgecases in kvm_argv(..)
  
  - Don't leak nbufp on realloc failure in kvm_argv
  - Catch malloc errors with bufp
  - Set buflen last in the "buflen == 0" case to ensure that
bufp/nbufp is properly reallocated on the next go around

Modified:
  stable/10/lib/libkvm/kvm_proc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libkvm/kvm_proc.c
==
--- stable/10/lib/libkvm/kvm_proc.c Fri May 13 09:50:38 2016
(r299650)
+++ stable/10/lib/libkvm/kvm_proc.c Fri May 13 09:52:39 2016
(r299651)
@@ -642,6 +642,7 @@ kvm_argv(kvm_t *kd, const struct kinfo_p
static char *buf, *p;
static char **bufp;
static int argc;
+   char **nbufp;
 
if (!ISALIVE(kd)) {
_kvm_err(kd, kd->program,
@@ -657,9 +658,15 @@ kvm_argv(kvm_t *kd, const struct kinfo_p
_kvm_err(kd, kd->program, "cannot allocate memory");
return (0);
}
-   buflen = nchr;
argc = 32;
bufp = malloc(sizeof(char *) * argc);
+   if (bufp == NULL) {
+   free(buf);
+   buf = NULL;
+   _kvm_err(kd, kd->program, "cannot allocate memory");
+   return (NULL);
+   }
+   buflen = nchr;
} else if (nchr > buflen) {
p = realloc(buf, nchr);
if (p != NULL) {
@@ -693,8 +700,10 @@ kvm_argv(kvm_t *kd, const struct kinfo_p
p += strlen(p) + 1;
if (i >= argc) {
argc += argc;
-   bufp = realloc(bufp,
-   sizeof(char *) * argc);
+   nbufp = realloc(bufp, sizeof(char *) * argc);
+   if (nbufp == NULL)
+   return (NULL);
+   bufp = nbufp;
}
} while (p < buf + bufsz);
bufp[i++] = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299650 - stable/9/lib/libkvm

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:50:38 2016
New Revision: 299650
URL: https://svnweb.freebsd.org/changeset/base/299650

Log:
  MFstable/10 r299649:
  
  MFC r298842:
  
  Don't leak PML4 in _amd64_initvtop(..) if kvm_read2(..) fails
  
  CID: 1341474

Modified:
  stable/9/lib/libkvm/kvm_amd64.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/lib/   (props changed)
  stable/9/lib/libkvm/   (props changed)

Modified: stable/9/lib/libkvm/kvm_amd64.c
==
--- stable/9/lib/libkvm/kvm_amd64.c Fri May 13 09:49:52 2016
(r299649)
+++ stable/9/lib/libkvm/kvm_amd64.c Fri May 13 09:50:38 2016
(r299650)
@@ -200,6 +200,7 @@ _kvm_initvtop(kvm_t *kd)
PML4 = _kvm_malloc(kd, PAGE_SIZE);
if (kvm_read(kd, pa, PML4, PAGE_SIZE) != PAGE_SIZE) {
_kvm_err(kd, kd->program, "cannot read KPML4phys");
+   free(PML4);
return (-1);
}
kd->vmst->PML4 = PML4;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299649 - stable/10/lib/libkvm

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:49:52 2016
New Revision: 299649
URL: https://svnweb.freebsd.org/changeset/base/299649

Log:
  MFC r298842:
  
  Don't leak PML4 in _amd64_initvtop(..) if kvm_read2(..) fails
  
  CID: 1341474

Modified:
  stable/10/lib/libkvm/kvm_amd64.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libkvm/kvm_amd64.c
==
--- stable/10/lib/libkvm/kvm_amd64.cFri May 13 09:46:23 2016
(r299648)
+++ stable/10/lib/libkvm/kvm_amd64.cFri May 13 09:49:52 2016
(r299649)
@@ -200,6 +200,7 @@ _kvm_initvtop(kvm_t *kd)
PML4 = _kvm_malloc(kd, PAGE_SIZE);
if (kvm_read(kd, pa, PML4, PAGE_SIZE) != PAGE_SIZE) {
_kvm_err(kd, kd->program, "cannot read KPML4phys");
+   free(PML4);
return (-1);
}
kd->vmst->PML4 = PML4;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299648 - stable/10/etc/rc.d

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:46:23 2016
New Revision: 299648
URL: https://svnweb.freebsd.org/changeset/base/299648

Log:
  MFC r298844:
  
  Make SERVERS REQUIRE clean when MK_KERBEROS==no
  
  Make kdc run BEFORE SERVERS instead of being REQUIREd by SERVERS,
  so systems that pedantically check REQUIREs function after r270782

Modified:
  stable/10/etc/rc.d/SERVERS
  stable/10/etc/rc.d/kdc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/SERVERS
==
--- stable/10/etc/rc.d/SERVERS  Fri May 13 09:42:57 2016(r299647)
+++ stable/10/etc/rc.d/SERVERS  Fri May 13 09:46:23 2016(r299648)
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: SERVERS
-# REQUIRE: mountcritremote abi ldconfig savecore watchdogd kdc
+# REQUIRE: mountcritremote abi ldconfig savecore watchdogd
 
 #  This is a dummy dependency, for early-start servers relying on
 #  some basic configuration.

Modified: stable/10/etc/rc.d/kdc
==
--- stable/10/etc/rc.d/kdc  Fri May 13 09:42:57 2016(r299647)
+++ stable/10/etc/rc.d/kdc  Fri May 13 09:46:23 2016(r299648)
@@ -5,6 +5,7 @@
 
 # PROVIDE: kdc
 # REQUIRE: NETWORKING
+# BEFORE: SERVERS
 # KEYWORD: shutdown
 
 . /etc/rc.subr
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299645 - in stable/9: share/man/man8 tools/build/mk

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:33:48 2016
New Revision: 299645
URL: https://svnweb.freebsd.org/changeset/base/299645

Log:
  MFstable/10 r299643:
  
  MFC r299162,r299163:
  
  r299162:
  
  Only install NIS section 8 manpages if MK_NIS != no
  
  r299163:
  
  Fix r299162
  
  share/man/man8/Makefile:
  - Add src.opts.mk so MK_NIS can be tested
  - Fix typo in MK_NIS conditional
  
  tools/build/mk/OptionalObsoleteFiles.inc:
  - Remove WIP diff from ^/user/ngie/detangle-rc

Modified:
  stable/9/share/man/man8/Makefile
  stable/9/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/9/   (props changed)
  stable/9/share/   (props changed)
  stable/9/share/man/   (props changed)
  stable/9/share/man/man8/   (props changed)
  stable/9/tools/   (props changed)
  stable/9/tools/build/   (props changed)

Modified: stable/9/share/man/man8/Makefile
==
--- stable/9/share/man/man8/MakefileFri May 13 09:32:05 2016
(r299644)
+++ stable/9/share/man/man8/MakefileFri May 13 09:33:48 2016
(r299645)
@@ -1,6 +1,8 @@
 #  @(#)Makefile8.1 (Berkeley) 6/5/93
 # $FreeBSD$
 
+.include 
+
 MAN=   crash.8 \
diskless.8 \
intro.8 \
@@ -10,7 +12,6 @@ MAN=  crash.8 \
rc.sendmail.8 \
rc.subr.8 \
rescue.8 \
-   yp.8
 
 MLINKS=rc.8 rc.atm.8 \
rc.8 rc.d.8 \
@@ -20,8 +21,13 @@ MLINKS=  rc.8 rc.atm.8 \
rc.8 rc.pccard.8 \
rc.8 rc.serial.8 \
rc.8 rc.shutdown.8
+
+.if ${MK_NIS} != "no"
+MAN+=  yp.8
+
 MLINKS+=yp.8 NIS.8 \
yp.8 nis.8 \
yp.8 YP.8
+.endif
 
 .include 

Modified: stable/9/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/9/tools/build/mk/OptionalObsoleteFiles.inc   Fri May 13 09:32:05 
2016(r299644)
+++ stable/9/tools/build/mk/OptionalObsoleteFiles.inc   Fri May 13 09:33:48 
2016(r299645)
@@ -3256,6 +3256,10 @@ OLD_FILES+=usr/share/man/man5/netid.5.gz
 OLD_FILES+=usr/share/man/man8/mknetid.8.gz
 OLD_FILES+=usr/share/man/man8/rpc.yppasswdd.8.gz
 OLD_FILES+=usr/share/man/man8/rpc.ypxfrd.8.gz
+OLD_FILES+=usr/share/man/man8/NIS.8.gz
+OLD_FILES+=usr/share/man/man8/YP.8.gz
+OLD_FILES+=usr/share/man/man8/yp.8.gz
+OLD_FILES+=usr/share/man/man8/nis.8.gz
 OLD_FILES+=usr/share/man/man8/yp_mkdb.8.gz
 OLD_FILES+=usr/share/man/man8/ypbind.8.gz
 OLD_FILES+=usr/share/man/man8/ypinit.8.gz
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299644 - stable/9/sys/ufs/ufs

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:32:05 2016
New Revision: 299644
URL: https://svnweb.freebsd.org/changeset/base/299644

Log:
  MFstable/10 r299640:
  
  MFC r298463:
  
  Add FEATURE knob for testing for UFS extended attribute kernel support
  
  Support can be verified via `feature_present("ufs_extattr")`, etc.
  
  Relnotes: yes

Modified:
  stable/9/sys/ufs/ufs/ufs_extattr.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ufs/ufs/ufs_extattr.c
==
--- stable/9/sys/ufs/ufs/ufs_extattr.c  Fri May 13 09:31:40 2016
(r299643)
+++ stable/9/sys/ufs/ufs/ufs_extattr.c  Fri May 13 09:32:05 2016
(r299644)
@@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$");
 
 #ifdef UFS_EXTATTR
 
+FEATURE(ufs_extattr, "ufs extended attribute support");
+
 static MALLOC_DEFINE(M_UFS_EXTATTR, "ufs_extattr", "ufs extended attribute");
 
 static int ufs_extattr_sync = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299643 - in stable/10: share/man/man8 tools/build/mk

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:31:40 2016
New Revision: 299643
URL: https://svnweb.freebsd.org/changeset/base/299643

Log:
  MFC r299162,r299163:
  
  r299162:
  
  Only install NIS section 8 manpages if MK_NIS != no
  
  r299163:
  
  Fix r299162
  
  share/man/man8/Makefile:
  - Add src.opts.mk so MK_NIS can be tested
  - Fix typo in MK_NIS conditional
  
  tools/build/mk/OptionalObsoleteFiles.inc:
  - Remove WIP diff from ^/user/ngie/detangle-rc

Modified:
  stable/10/share/man/man8/Makefile
  stable/10/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man8/Makefile
==
--- stable/10/share/man/man8/Makefile   Fri May 13 09:24:16 2016
(r299642)
+++ stable/10/share/man/man8/Makefile   Fri May 13 09:31:40 2016
(r299643)
@@ -1,6 +1,8 @@
 #  @(#)Makefile8.1 (Berkeley) 6/5/93
 # $FreeBSD$
 
+.include 
+
 MAN=   crash.8 \
diskless.8 \
intro.8 \
@@ -11,7 +13,6 @@ MAN=  crash.8 \
rc.subr.8 \
rescue.8 \
${_uefi.8} \
-   yp.8
 
 MLINKS=rc.8 rc.atm.8 \
rc.8 rc.d.8 \
@@ -21,9 +22,14 @@ MLINKS=  rc.8 rc.atm.8 \
rc.8 rc.pccard.8 \
rc.8 rc.serial.8 \
rc.8 rc.shutdown.8
+
+.if ${MK_NIS} != "no"
+MAN+=  yp.8
+
 MLINKS+=yp.8 NIS.8 \
yp.8 nis.8 \
yp.8 YP.8
+.endif
 
 .if ${MACHINE_CPUARCH} == "amd64"
 _uefi.8= uefi.8

Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/10/tools/build/mk/OptionalObsoleteFiles.inc  Fri May 13 09:24:16 
2016(r299642)
+++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc  Fri May 13 09:31:40 
2016(r299643)
@@ -3662,6 +3662,10 @@ OLD_FILES+=usr/share/man/man5/netid.5.gz
 OLD_FILES+=usr/share/man/man8/mknetid.8.gz
 OLD_FILES+=usr/share/man/man8/rpc.yppasswdd.8.gz
 OLD_FILES+=usr/share/man/man8/rpc.ypxfrd.8.gz
+OLD_FILES+=usr/share/man/man8/NIS.8.gz
+OLD_FILES+=usr/share/man/man8/YP.8.gz
+OLD_FILES+=usr/share/man/man8/yp.8.gz
+OLD_FILES+=usr/share/man/man8/nis.8.gz
 OLD_FILES+=usr/share/man/man8/yp_mkdb.8.gz
 OLD_FILES+=usr/share/man/man8/ypbind.8.gz
 OLD_FILES+=usr/share/man/man8/ypinit.8.gz
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299641 - head/sys/compat/linuxkpi/common/include/linux

2016-05-13 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 13 09:21:22 2016
New Revision: 299641
URL: https://svnweb.freebsd.org/changeset/base/299641

Log:
  The Linux error defines should all be positive, else frequently used
  error code checks might fail. ERESTART is in the BSD world defined as
  -1. While at it add more Linux error codes.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/errno.h

Modified: head/sys/compat/linuxkpi/common/include/linux/errno.h
==
--- head/sys/compat/linuxkpi/common/include/linux/errno.h   Fri May 13 
09:18:46 2016(r299640)
+++ head/sys/compat/linuxkpi/common/include/linux/errno.h   Fri May 13 
09:21:22 2016(r299641)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,8 +38,23 @@
 #defineECOMM   ESTALE
 #defineENODATA ECONNREFUSED
 #defineENOIOCTLCMD ENOIOCTL
-#defineERESTARTSYS ERESTART
+/* Use same value as Linux, because BSD's ERESTART is negative */
+#defineERESTARTSYS 512
 #defineENOTSUPPEOPNOTSUPP
 #defineENONET  EHOSTDOWN
 
+#defineERESTARTNOINTR  513
+#defineERESTARTNOHAND  514
+#defineERESTART_RESTARTBLOCK 516
+#defineEPROBE_DEFER517
+#defineEOPENSTALE  518
+#defineEBADHANDLE  521
+#defineENOTSYNC522
+#defineEBADCOOKIE  523
+#defineETOOSMALL   525
+#defineESERVERFAULT526
+#defineEBADTYPE527
+#defineEJUKEBOX528
+#defineEIOCBQUEUED 529
+
 #endif /* _LINUX_ERRNO_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299640 - stable/10/sys/ufs/ufs

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:18:46 2016
New Revision: 299640
URL: https://svnweb.freebsd.org/changeset/base/299640

Log:
  MFC r298463:
  
  Add FEATURE knob for testing for UFS extended attribute kernel support
  
  Support can be verified via `feature_present("ufs_extattr")`, etc.
  
  Relnotes: yes

Modified:
  stable/10/sys/ufs/ufs/ufs_extattr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ufs/ufs/ufs_extattr.c
==
--- stable/10/sys/ufs/ufs/ufs_extattr.c Fri May 13 09:16:01 2016
(r299639)
+++ stable/10/sys/ufs/ufs/ufs_extattr.c Fri May 13 09:18:46 2016
(r299640)
@@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$");
 
 #ifdef UFS_EXTATTR
 
+FEATURE(ufs_extattr, "ufs extended attribute support");
+
 static MALLOC_DEFINE(M_UFS_EXTATTR, "ufs_extattr", "ufs extended attribute");
 
 static int ufs_extattr_sync = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299639 - stable/9/contrib/bsnmp/snmp_mibII

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:16:01 2016
New Revision: 299639
URL: https://svnweb.freebsd.org/changeset/base/299639

Log:
  MFstable/10 r299638:
  
  MFC r298462:
  
  Return `ret` in op_ifentry(..) to mute a -Wunused-but-set-variable warning
  
  This will also now detect error conditions with
  value->var.subs[sub - 1] == LEAF_ifPhysAddress where `string_get(..)`
  could fail if iifp->physaddr and/or iifp->physaddrlen were deemed
  invalid.
  
  CID: 1006551

Modified:
  stable/9/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/bsnmp/   (props changed)
  stable/9/contrib/bsnmp/snmp_mibII/   (props changed)

Modified: stable/9/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
==
--- stable/9/contrib/bsnmp/snmp_mibII/mibII_interfaces.cFri May 13 
09:14:43 2016(r299638)
+++ stable/9/contrib/bsnmp/snmp_mibII/mibII_interfaces.cFri May 13 
09:16:01 2016(r299639)
@@ -356,7 +356,7 @@ op_ifentry(struct snmp_context *ctx, str
value->v.oid = ifp->spec_oid;
break;
}
-   return (SNMP_ERR_NOERROR);
+   return (ret);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299638 - stable/10/contrib/bsnmp/snmp_mibII

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:14:43 2016
New Revision: 299638
URL: https://svnweb.freebsd.org/changeset/base/299638

Log:
  MFC r298462:
  
  Return `ret` in op_ifentry(..) to mute a -Wunused-but-set-variable warning
  
  This will also now detect error conditions with
  value->var.subs[sub - 1] == LEAF_ifPhysAddress where `string_get(..)`
  could fail if iifp->physaddr and/or iifp->physaddrlen were deemed
  invalid.
  
  CID: 1006551

Modified:
  stable/10/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
==
--- stable/10/contrib/bsnmp/snmp_mibII/mibII_interfaces.c   Fri May 13 
09:11:41 2016(r299637)
+++ stable/10/contrib/bsnmp/snmp_mibII/mibII_interfaces.c   Fri May 13 
09:14:43 2016(r299638)
@@ -356,7 +356,7 @@ op_ifentry(struct snmp_context *ctx, str
value->v.oid = ifp->spec_oid;
break;
}
-   return (SNMP_ERR_NOERROR);
+   return (ret);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299637 - head/sys/netinet

2016-05-13 Thread Michael Tuexen
Author: tuexen
Date: Fri May 13 09:11:41 2016
New Revision: 299637
URL: https://svnweb.freebsd.org/changeset/base/299637

Log:
  Fix a bug introduced by the implementation of I-DATA support.
  There was the requirement that two structures are in sync,
  which is not valid anymore. Therefore don't rely on this
  in the code anymore.
  Thanks to Radek Malcic for reporting the issue. He found this
  when using the userland stack.
  
  MFC after: 1 week

Modified:
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_structs.h
==
--- head/sys/netinet/sctp_structs.h Fri May 13 09:07:42 2016
(r299636)
+++ head/sys/netinet/sctp_structs.h Fri May 13 09:11:41 2016
(r299637)
@@ -452,11 +452,6 @@ struct sctp_tmit_chunk {
uint8_t window_probe;
 };
 
-/*
- * The first part of this structure MUST be the entire sinfo structure. Maybe
- * I should have made it a sub structure... we can circle back later and do
- * that if we want.
- */
 struct sctp_queued_to_read {   /* sinfo structure Pluse more */
uint16_t sinfo_stream;  /* off the wire */
uint32_t sinfo_ssn; /* off the wire */

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Fri May 13 09:07:42 2016(r299636)
+++ head/sys/netinet/sctputil.c Fri May 13 09:11:41 2016(r299637)
@@ -5545,8 +5545,16 @@ found_one:
stcb->asoc.strmin[control->sinfo_stream].delivery_started = 1;
}
/* First lets get off the sinfo and sockaddr info */
-   if ((sinfo) && filling_sinfo) {
-   memcpy(sinfo, control, sizeof(struct sctp_nonpad_sndrcvinfo));
+   if ((sinfo != NULL) && (filling_sinfo != 0)) {
+   sinfo->sinfo_stream = control->sinfo_stream;
+   sinfo->sinfo_ssn = (uint16_t) control->sinfo_ssn;
+   sinfo->sinfo_flags = control->sinfo_flags;
+   sinfo->sinfo_ppid = control->sinfo_ppid;
+   sinfo->sinfo_context = control->sinfo_context;
+   sinfo->sinfo_timetolive = control->sinfo_timetolive;
+   sinfo->sinfo_tsn = control->sinfo_tsn;
+   sinfo->sinfo_cumtsn = control->sinfo_cumtsn;
+   sinfo->sinfo_assoc_id = control->sinfo_assoc_id;
nxt = TAILQ_NEXT(control, next);
if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXT_RCVINFO) ||
sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVNXTINFO)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299636 - stable/9/sys/dev/aacraid

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:07:42 2016
New Revision: 299636
URL: https://svnweb.freebsd.org/changeset/base/299636

Log:
  MFstable/10 r299635:
  
  MFC r298665:
  r298665 (by cem):
  
  aacraid(4): Fix some mostly trivial buffer overruns
  
  strcpy(3) emits a trailing nul byte, trampling fields after the intended
  destination.  Instead, use strncpy(3), intentionally leaving these fields
  not nul-terminated.
  
  CIDs: 1031024, 1305463, 1305494, 1305545

Modified:
  stable/9/sys/dev/aacraid/aacraid_cam.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/aacraid/aacraid_cam.c
==
--- stable/9/sys/dev/aacraid/aacraid_cam.c  Fri May 13 09:06:52 2016
(r299635)
+++ stable/9/sys/dev/aacraid/aacraid_cam.c  Fri May 13 09:07:42 2016
(r299636)
@@ -570,9 +570,11 @@ aac_container_special_command(struct cam
p->additional_length = 31;
p->flags = SID_WBus16|SID_Sync|SID_CmdQue;
/* OEM Vendor defines */
-   strcpy(p->vendor,"Adaptec ");
-   strcpy(p->product,"Array   ");
-   strcpy(p->revision,"V1.0");
+   strncpy(p->vendor, "Adaptec ", 
sizeof(p->vendor));
+   strncpy(p->product, "Array   ",
+   sizeof(p->product));
+   strncpy(p->revision, "V1.0",
+   sizeof(p->revision));
}   
} else {
if (inq->page_code == SVPD_SUPPORTED_PAGE_LIST) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299635 - stable/10/sys/dev/aacraid

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:06:52 2016
New Revision: 299635
URL: https://svnweb.freebsd.org/changeset/base/299635

Log:
  MFC r298665:
  r298665 (by cem):
  
  aacraid(4): Fix some mostly trivial buffer overruns
  
  strcpy(3) emits a trailing nul byte, trampling fields after the intended
  destination.  Instead, use strncpy(3), intentionally leaving these fields
  not nul-terminated.
  
  CIDs: 1031024, 1305463, 1305494, 1305545

Modified:
  stable/10/sys/dev/aacraid/aacraid_cam.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/aacraid/aacraid_cam.c
==
--- stable/10/sys/dev/aacraid/aacraid_cam.c Fri May 13 09:05:29 2016
(r299634)
+++ stable/10/sys/dev/aacraid/aacraid_cam.c Fri May 13 09:06:52 2016
(r299635)
@@ -570,9 +570,11 @@ aac_container_special_command(struct cam
p->additional_length = 31;
p->flags = SID_WBus16|SID_Sync|SID_CmdQue;
/* OEM Vendor defines */
-   strcpy(p->vendor,"Adaptec ");
-   strcpy(p->product,"Array   ");
-   strcpy(p->revision,"V1.0");
+   strncpy(p->vendor, "Adaptec ", 
sizeof(p->vendor));
+   strncpy(p->product, "Array   ",
+   sizeof(p->product));
+   strncpy(p->revision, "V1.0",
+   sizeof(p->revision));
}   
} else {
if (inq->page_code == SVPD_SUPPORTED_PAGE_LIST) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299634 - stable/10/sys/dev/ciss

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:05:29 2016
New Revision: 299634
URL: https://svnweb.freebsd.org/changeset/base/299634

Log:
  MFC r298670:
  r298670 (by cem):
  
  ciss(4): Fix overrun of array
  
  The softc member 'ciss_logical' is an array of 'ciss_max_logical_bus' members.
  Most of the time it is iterated correctly.  This patch fixes the two instances
  where the driver iterated off the end of the array.
  
  CID:  1305492

Modified:
  stable/10/sys/dev/ciss/ciss.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ciss/ciss.c
==
--- stable/10/sys/dev/ciss/ciss.c   Fri May 13 09:02:28 2016
(r299633)
+++ stable/10/sys/dev/ciss/ciss.c   Fri May 13 09:05:29 2016
(r299634)
@@ -1431,7 +1431,7 @@ ciss_init_logical(struct ciss_softc *sc)
goto out;
 }
 
-for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
+for (i = 0; i < sc->ciss_max_logical_bus; i++) {
sc->ciss_logical[i] =
malloc(sc->ciss_cfg->max_logical_supported *
   sizeof(struct ciss_ldrive),
@@ -2030,7 +2030,7 @@ ciss_free(struct ciss_softc *sc)
 if (sc->ciss_parent_dmat)
bus_dma_tag_destroy(sc->ciss_parent_dmat);
 if (sc->ciss_logical) {
-   for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
+   for (i = 0; i < sc->ciss_max_logical_bus; i++) {
for (j = 0; j < sc->ciss_cfg->max_logical_supported; j++) {
if (sc->ciss_logical[i][j].cl_ldrive)
free(sc->ciss_logical[i][j].cl_ldrive, CISS_MALLOC_CLASS);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299633 - stable/9/sys/dev/sound/midi

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:02:28 2016
New Revision: 299633
URL: https://svnweb.freebsd.org/changeset/base/299633

Log:
  MFstable/10 r299632:
  
  MFC r298339:
  r298339 (by cem):
  
  sound(4): Don't use-after-free in midi module unload
  
  Also, use ANSI function parameter definitions (void) while here.
  
  CID:  1006107

Modified:
  stable/9/sys/dev/sound/midi/midi.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/sound/midi/midi.c
==
--- stable/9/sys/dev/sound/midi/midi.c  Fri May 13 09:01:20 2016
(r299632)
+++ stable/9/sys/dev/sound/midi/midi.c  Fri May 13 09:02:28 2016
(r299633)
@@ -1397,7 +1397,7 @@ midi_destroy(struct snd_midi *m, int mid
  */
 
 static int
-midi_load()
+midi_load(void)
 {
mtx_init(_lock, "midistat lock", NULL, 0);
TAILQ_INIT(_devs); /* Initialize the queue. */
@@ -1410,9 +1410,9 @@ midi_load()
 }
 
 static int
-midi_unload()
+midi_unload(void)
 {
-   struct snd_midi *m;
+   struct snd_midi *m, *tmp;
int retval;
 
MIDI_DEBUG(1, printf("midi_unload()\n"));
@@ -1421,7 +1421,7 @@ midi_unload()
if (midistat_isopen)
goto exit0;
 
-   TAILQ_FOREACH(m, _devs, link) {
+   TAILQ_FOREACH_SAFE(m, _devs, link, tmp) {
mtx_lock(>lock);
if (m->busy)
retval = EBUSY;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299632 - stable/10/sys/dev/sound/midi

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 09:01:20 2016
New Revision: 299632
URL: https://svnweb.freebsd.org/changeset/base/299632

Log:
  MFC r298339:
  r298339 (by cem):
  
  sound(4): Don't use-after-free in midi module unload
  
  Also, use ANSI function parameter definitions (void) while here.
  
  CID:  1006107

Modified:
  stable/10/sys/dev/sound/midi/midi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sound/midi/midi.c
==
--- stable/10/sys/dev/sound/midi/midi.c Fri May 13 08:59:49 2016
(r299631)
+++ stable/10/sys/dev/sound/midi/midi.c Fri May 13 09:01:20 2016
(r299632)
@@ -1401,7 +1401,7 @@ midi_destroy(struct snd_midi *m, int mid
  */
 
 static int
-midi_load()
+midi_load(void)
 {
mtx_init(_lock, "midistat lock", NULL, 0);
TAILQ_INIT(_devs); /* Initialize the queue. */
@@ -1414,9 +1414,9 @@ midi_load()
 }
 
 static int
-midi_unload()
+midi_unload(void)
 {
-   struct snd_midi *m;
+   struct snd_midi *m, *tmp;
int retval;
 
MIDI_DEBUG(1, printf("midi_unload()\n"));
@@ -1425,7 +1425,7 @@ midi_unload()
if (midistat_isopen)
goto exit0;
 
-   TAILQ_FOREACH(m, _devs, link) {
+   TAILQ_FOREACH_SAFE(m, _devs, link, tmp) {
mtx_lock(>lock);
if (m->busy)
retval = EBUSY;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299631 - stable/9/sys/dev/sym

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:59:49 2016
New Revision: 299631
URL: https://svnweb.freebsd.org/changeset/base/299631

Log:
  MFstable/10 r299630:
  
  MFC r298340:
  r298340 (by cem):
  
  sym(4): Don't double-free 'sim' in failure case
  
  CID:  1006106

Modified:
  stable/9/sys/dev/sym/sym_hipd.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/sym/sym_hipd.c
==
--- stable/9/sys/dev/sym/sym_hipd.c Fri May 13 08:58:49 2016
(r299630)
+++ stable/9/sys/dev/sym/sym_hipd.c Fri May 13 08:59:49 2016
(r299631)
@@ -8891,6 +8891,7 @@ static int sym_cam_attach(hcb_p np)
if (xpt_bus_register(sim, np->device, 0) != CAM_SUCCESS)
goto fail;
np->sim = sim;
+   sim = NULL;
 
if (xpt_create_path(, NULL,
cam_sim_path(np->sim), CAM_TARGET_WILDCARD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299630 - stable/10/sys/dev/sym

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:58:49 2016
New Revision: 299630
URL: https://svnweb.freebsd.org/changeset/base/299630

Log:
  MFC r298340:
  r298340 (by cem):
  
  sym(4): Don't double-free 'sim' in failure case
  
  CID:  1006106

Modified:
  stable/10/sys/dev/sym/sym_hipd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sym/sym_hipd.c
==
--- stable/10/sys/dev/sym/sym_hipd.cFri May 13 08:54:08 2016
(r299629)
+++ stable/10/sys/dev/sym/sym_hipd.cFri May 13 08:58:49 2016
(r299630)
@@ -8894,6 +8894,7 @@ static int sym_cam_attach(hcb_p np)
if (xpt_bus_register(sim, np->device, 0) != CAM_SUCCESS)
goto fail;
np->sim = sim;
+   sim = NULL;
 
if (xpt_create_path(, NULL,
cam_sim_path(np->sim), CAM_TARGET_WILDCARD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299629 - stable/10/sys/geom/part

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:54:08 2016
New Revision: 299629
URL: https://svnweb.freebsd.org/changeset/base/299629

Log:
  MFC r298671,r298672:
  
  r298671 (by cem):
  
  g_part_bsd64: Check for valid on-disk npartitions value
  
  This value is u32 on disk, but assigned to an int in memory.  After we do the
  implicit conversion via assignment, check that the result is at least one[1]
  (non-negative[2]).
  
  1. The subsequent for-loop iterates from gpt_entries minus one, down, until
 reaching zero.  A negative or zero initial index results in undefined 
signed
 integer overflow.
  2. It is also used to index into arrays later.
  
  In practice, we expected non-malicious disks to contain small positive values.
  
  CID:  1223202
  
  r298672 (by cem):
  
  g_part_bsd64: Delete duplicate/dead code
  
  RAW_PART is handled earlier in the loop.
  
  CID:  1223201

Modified:
  stable/10/sys/geom/part/g_part_bsd64.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/geom/part/g_part_bsd64.c
==
--- stable/10/sys/geom/part/g_part_bsd64.c  Fri May 13 08:51:51 2016
(r299628)
+++ stable/10/sys/geom/part/g_part_bsd64.c  Fri May 13 08:54:08 2016
(r299629)
@@ -510,7 +510,8 @@ g_part_bsd64_read(struct g_part_table *b
 
dlp = (struct disklabel64 *)buf;
basetable->gpt_entries = le32toh(dlp->d_npartitions);
-   if (basetable->gpt_entries > MAXPARTITIONS64)
+   if (basetable->gpt_entries > MAXPARTITIONS64 ||
+   basetable->gpt_entries < 1)
goto invalid_label;
v32 = le32toh(dlp->d_crc);
dlp->d_crc = 0;
@@ -563,8 +564,6 @@ g_part_bsd64_read(struct g_part_table *b
le_uuid_dec(>d_partitions[index].p_stor_uuid,
>stor_uuid);
entry->fstype = dlp->d_partitions[index].p_fstype;
-   if (index == RAW_PART)
-   baseentry->gpe_internal = 1;
}
bcopy(dlp->d_reserved0, table->d_reserved0,
sizeof(table->d_reserved0));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299628 - stable/9/sys/netipsec

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:51:51 2016
New Revision: 299628
URL: https://svnweb.freebsd.org/changeset/base/299628

Log:
  MFstable/10 r299627:
  
  MFC r298676:
  r298676 (by cem):
  
  netipsec: Don't leak memory when deep copy fails
  
  CID:  1331693

Modified:
  stable/9/sys/netipsec/ipsec.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netipsec/ipsec.c
==
--- stable/9/sys/netipsec/ipsec.c   Fri May 13 08:49:29 2016
(r299627)
+++ stable/9/sys/netipsec/ipsec.c   Fri May 13 08:51:51 2016
(r299628)
@@ -936,6 +936,7 @@ fail:
ipsec_delisr(p);
p = NULL;
}
+   KEY_FREESP();
return (NULL);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299627 - stable/10/sys/netipsec

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:49:29 2016
New Revision: 299627
URL: https://svnweb.freebsd.org/changeset/base/299627

Log:
  MFC r298676:
  r298676 (by cem):
  
  netipsec: Don't leak memory when deep copy fails
  
  CID:  1331693

Modified:
  stable/10/sys/netipsec/ipsec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netipsec/ipsec.c
==
--- stable/10/sys/netipsec/ipsec.c  Fri May 13 08:46:13 2016
(r299626)
+++ stable/10/sys/netipsec/ipsec.c  Fri May 13 08:49:29 2016
(r299627)
@@ -940,6 +940,7 @@ fail:
ipsec_delisr(p);
p = NULL;
}
+   KEY_FREESP();
return (NULL);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299626 - stable/9/sys/kern

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:46:13 2016
New Revision: 299626
URL: https://svnweb.freebsd.org/changeset/base/299626

Log:
  MFstable/10 r299625:
  
  MFC r298677:
  r298677 (by cem):
  
  subr_mbpool: Don't free bogus pointer in error paths
  
  An mbpool is allocated with a contiguous array of mbpages.  Freeing an
  individual mbpage has never been valid.  Don't do it.
  
  This bug has been present since this code was introduced in r117624 (2003).
  
  CID:  1009687

Modified:
  stable/9/sys/kern/subr_mbpool.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/subr_mbpool.c
==
--- stable/9/sys/kern/subr_mbpool.c Fri May 13 08:44:59 2016
(r299625)
+++ stable/9/sys/kern/subr_mbpool.c Fri May 13 08:46:13 2016
(r299626)
@@ -209,16 +209,13 @@ mbp_alloc_page(struct mbpool *p)
pg = >pages[p->npages];
 
error = bus_dmamem_alloc(p->dmat, >va, BUS_DMA_NOWAIT, >map);
-   if (error != 0) {
-   free(pg, M_MBPOOL);
+   if (error != 0)
return;
-   }
 
error = bus_dmamap_load(p->dmat, pg->map, pg->va, p->page_size,
mbp_callback, >phy, 0);
if (error != 0) {
bus_dmamem_free(p->dmat, pg->va, pg->map);
-   free(pg, M_MBPOOL);
return;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299625 - stable/10/sys/kern

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:44:59 2016
New Revision: 299625
URL: https://svnweb.freebsd.org/changeset/base/299625

Log:
  MFC r298677:
  r298677 (by cem):
  
  subr_mbpool: Don't free bogus pointer in error paths
  
  An mbpool is allocated with a contiguous array of mbpages.  Freeing an
  individual mbpage has never been valid.  Don't do it.
  
  This bug has been present since this code was introduced in r117624 (2003).
  
  CID:  1009687

Modified:
  stable/10/sys/kern/subr_mbpool.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/subr_mbpool.c
==
--- stable/10/sys/kern/subr_mbpool.cFri May 13 08:42:21 2016
(r299624)
+++ stable/10/sys/kern/subr_mbpool.cFri May 13 08:44:59 2016
(r299625)
@@ -210,16 +210,13 @@ mbp_alloc_page(struct mbpool *p)
pg = >pages[p->npages];
 
error = bus_dmamem_alloc(p->dmat, >va, BUS_DMA_NOWAIT, >map);
-   if (error != 0) {
-   free(pg, M_MBPOOL);
+   if (error != 0)
return;
-   }
 
error = bus_dmamap_load(p->dmat, pg->map, pg->va, p->page_size,
mbp_callback, >phy, 0);
if (error != 0) {
bus_dmamem_free(p->dmat, pg->va, pg->map);
-   free(pg, M_MBPOOL);
return;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299624 - stable/9/sys/dev/pty

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:42:21 2016
New Revision: 299624
URL: https://svnweb.freebsd.org/changeset/base/299624

Log:
  MFstable/10 r299623:
  
  MFC r298337:
  r298337 (by cem):
  
  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.
  
  CID:  1006768

Modified:
  stable/9/sys/dev/pty/pty.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/pty/pty.c
==
--- stable/9/sys/dev/pty/pty.c  Fri May 13 08:41:09 2016(r299623)
+++ stable/9/sys/dev/pty/pty.c  Fri May 13 08:42:21 2016(r299624)
@@ -67,7 +67,7 @@ ptydev_fdopen(struct cdev *dev, int ffla
return (EBUSY);
 
/* Generate device name and create PTY. */
-   strcpy(name, devtoname(dev));
+   strlcpy(name, devtoname(dev), sizeof(name));
name[0] = 't';
 
error = pts_alloc_external(fflags & (FREAD|FWRITE), td, fp, dev, name);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299623 - stable/10/sys/dev/pty

2016-05-13 Thread Garrett Cooper
Author: ngie
Date: Fri May 13 08:41:09 2016
New Revision: 299623
URL: https://svnweb.freebsd.org/changeset/base/299623

Log:
  MFC r298337:
  r298337 (by cem):
  
  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.
  
  CID:  1006768

Modified:
  stable/10/sys/dev/pty/pty.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/pty/pty.c
==
--- stable/10/sys/dev/pty/pty.c Fri May 13 08:39:33 2016(r299622)
+++ stable/10/sys/dev/pty/pty.c Fri May 13 08:41:09 2016(r299623)
@@ -67,7 +67,7 @@ ptydev_fdopen(struct cdev *dev, int ffla
return (EBUSY);
 
/* Generate device name and create PTY. */
-   strcpy(name, devtoname(dev));
+   strlcpy(name, devtoname(dev), sizeof(name));
name[0] = 't';
 
error = pts_alloc_external(fflags & (FREAD|FWRITE), td, fp, dev, name);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   >