svn commit: r285849 - stable/10/usr.sbin/pmcstudy

2015-07-24 Thread Ed Maste
Author: emaste
Date: Fri Jul 24 19:09:11 2015
New Revision: 285849
URL: https://svnweb.freebsd.org/changeset/base/285849

Log:
  MFC r277485 by rrs: Fix minor errors found by coverity.
  
  PR:   201594
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/usr.sbin/pmcstudy/pmcstudy.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pmcstudy/pmcstudy.c
==
--- stable/10/usr.sbin/pmcstudy/pmcstudy.c  Fri Jul 24 19:05:08 2015
(r285848)
+++ stable/10/usr.sbin/pmcstudy/pmcstudy.c  Fri Jul 24 19:09:11 2015
(r285849)
@@ -1808,6 +1808,9 @@ process_file(char *filename)
if (cnts == NULL) {
/* Nothing we can do */
printf(Nothing to do -- no counters built\n);
+   if (io) {
+   fclose(io);
+   }
return;
}
lace_cpus_together();
@@ -2044,7 +2047,7 @@ get_cpuid_set(void)
printf(No memory3 allocation fails at 
startup?\n);
exit(-1);
}
-   memset(more, sz, 0);
+   memset(more, 0, sz);
memcpy(more, valid_pmcs, sz);
pmc_allocated_cnt *= 2;
free(valid_pmcs);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r285856 - in stable/10/usr.sbin/ntp: . ntpd

2015-07-24 Thread Xin LI
Author: delphij
Date: Fri Jul 24 19:51:51 2015
New Revision: 285856
URL: https://svnweb.freebsd.org/changeset/base/285856

Log:
  MFC r285701:
  
  Use fixed date/time (the time choosen was the time the import was done
  on -HEAD) in libntp so we can make reproducible build.
  
  PR:   bin/201661
  Differential Revision:https://reviews.freebsd.org/D3122
  
  While I'm there also remove libmd from linkage as reported in bin/201738
  
  PR:   bin/201738
  Submitted by: John Marshall

Modified:
  stable/10/usr.sbin/ntp/config.h
  stable/10/usr.sbin/ntp/ntpd/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ntp/config.h
==
--- stable/10/usr.sbin/ntp/config.h Fri Jul 24 19:50:55 2015
(r285855)
+++ stable/10/usr.sbin/ntp/config.h Fri Jul 24 19:51:51 2015
(r285856)
@@ -1785,3 +1785,8 @@ typedef union mpinfou {
# endif
#endif  /* !defined(_KERNEL)  !defined(PARSESTREAM) */

+/*
+ * FreeBSD specific: Explicitly specify date/time for reproducible build.
+ */
+#defineMKREPRO_DATE Jul 04 2015
+#defineMKREPRO_TIME 15:42:16

Modified: stable/10/usr.sbin/ntp/ntpd/Makefile
==
--- stable/10/usr.sbin/ntp/ntpd/MakefileFri Jul 24 19:50:55 2015
(r285855)
+++ stable/10/usr.sbin/ntp/ntpd/MakefileFri Jul 24 19:51:51 2015
(r285856)
@@ -27,8 +27,8 @@ SRCS= cmd_args.c ntp_config.c ntp_contro
refclock_tt560.c refclock_ulink.c refclock_wwv.c refclock_wwvb.c \
refclock_zyfer.c version.c
 
-DPADD= ${LIBPARSE} ${LIBNTP} ${LIBM} ${LIBMD} ${LIBOPTS} ${LIBPTHREAD}
-LDADD= ${LIBPARSE} ${LIBNTP} -lm -lmd ${LIBOPTS} -lpthread
+DPADD= ${LIBPARSE} ${LIBNTP} ${LIBM} ${LIBOPTS} ${LIBPTHREAD}
+LDADD= ${LIBPARSE} ${LIBNTP} -lm ${LIBOPTS} -lpthread
 
 CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/ntpd \
-I${.CURDIR}/../../../contrib/ntp/include \
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r285851 - stable/10/usr.sbin/bsnmpd/modules/snmp_hostres

2015-07-24 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jul 24 19:21:48 2015
New Revision: 285851
URL: https://svnweb.freebsd.org/changeset/base/285851

Log:
  MFC   r285719:
  snmp_hostres(3): Fix buffer overflow.
  
  Actually just a typo. Detected by gcc + FORTIFY_SOURCE patches.
  
  CID:  1007594

Modified:
  stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c
==
--- stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c
Fri Jul 24 19:16:16 2015(r285850)
+++ stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c
Fri Jul 24 19:21:48 2015(r285851)
@@ -175,7 +175,7 @@ get_printer_status(const struct printer 
goto LABEL_DONE;
}
 
-   memset(fline[0], '\0', sizeof(line));
+   memset(fline[0], '\0', sizeof(fline));
if (fgets(fline, sizeof(fline) -1, f) == NULL) {
ps = PS_UNKNOWN;
goto LABEL_DONE;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r285863 - in stable/10/sys/dev: pccbb pci

2015-07-24 Thread John Baldwin
Author: jhb
Date: Sat Jul 25 00:14:02 2015
New Revision: 285863
URL: https://svnweb.freebsd.org/changeset/base/285863

Log:
  Partially revert r284034.  In particular, revert the final change in this
  MFC (281874).  It broke suspend and resume on several Thinkpads (though not
  all) in 10 even though it works fine on the same laptops in HEAD.
  
  PR:   201239
  Reported by:  Kevin Oberman and several others

Modified:
  stable/10/sys/dev/pccbb/pccbb_pci.c
  stable/10/sys/dev/pci/pci.c
  stable/10/sys/dev/pci/pci_pci.c
  stable/10/sys/dev/pci/pcib_private.h
  stable/10/sys/dev/pci/pcivar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/pccbb/pccbb_pci.c
==
--- stable/10/sys/dev/pccbb/pccbb_pci.c Fri Jul 24 22:13:39 2015
(r285862)
+++ stable/10/sys/dev/pccbb/pccbb_pci.c Sat Jul 25 00:14:02 2015
(r285863)
@@ -259,6 +259,32 @@ cbb_pci_probe(device_t brdev)
 }
 
 /*
+ * Still need this because the pci code only does power for type 0
+ * header devices.
+ */
+static void
+cbb_powerstate_d0(device_t dev)
+{
+   u_int32_t membase, irq;
+
+   if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
+   /* Save important PCI config data. */
+   membase = pci_read_config(dev, CBBR_SOCKBASE, 4);
+   irq = pci_read_config(dev, PCIR_INTLINE, 4);
+
+   /* Reset the power state. */
+   device_printf(dev, chip is in D%d power mode 
+   -- setting to D0\n, pci_get_powerstate(dev));
+
+   pci_set_powerstate(dev, PCI_POWERSTATE_D0);
+
+   /* Restore PCI config data. */
+   pci_write_config(dev, CBBR_SOCKBASE, membase, 4);
+   pci_write_config(dev, PCIR_INTLINE, irq, 4);
+   }
+}
+
+/*
  * Print out the config space
  */
 static void
@@ -295,15 +321,15 @@ cbb_pci_attach(device_t brdev)
sc-cbdev = NULL;
sc-exca[0].pccarddev = NULL;
sc-domain = pci_get_domain(brdev);
+   sc-bus.sec = pci_read_config(brdev, PCIR_SECBUS_2, 1);
+   sc-bus.sub = pci_read_config(brdev, PCIR_SUBBUS_2, 1);
sc-pribus = pcib_get_bus(parent);
 #if defined(NEW_PCIB)  defined(PCI_RES_BUS)
pci_write_config(brdev, PCIR_PRIBUS_2, sc-pribus, 1);
pcib_setup_secbus(brdev, sc-bus, 1);
-#else
-   sc-bus.sec = pci_read_config(brdev, PCIR_SECBUS_2, 1);
-   sc-bus.sub = pci_read_config(brdev, PCIR_SUBBUS_2, 1);
 #endif
SLIST_INIT(sc-rl);
+   cbb_powerstate_d0(brdev);
 
rid = CBBR_SOCKBASE;
sc-base_res = bus_alloc_resource_any(brdev, SYS_RES_MEMORY, rid,
@@ -448,6 +474,11 @@ cbb_chipinit(struct cbb_softc *sc)
if (pci_read_config(sc-dev, PCIR_LATTIMER, 1)  0x20)
pci_write_config(sc-dev, PCIR_LATTIMER, 0x20, 1);
 
+   /* Restore bus configuration */
+   pci_write_config(sc-dev, PCIR_PRIBUS_2, sc-pribus, 1);
+   pci_write_config(sc-dev, PCIR_SECBUS_2, sc-bus.sec, 1);
+   pci_write_config(sc-dev, PCIR_SUBBUS_2, sc-bus.sub, 1);
+
/* Enable DMA, memory access for this card and I/O acces for children */
pci_enable_busmaster(sc-dev);
pci_enable_io(sc-dev, SYS_RES_IOPORT);
@@ -875,10 +906,15 @@ cbb_pci_resume(device_t brdev)
 * from D0 and back to D0 cause the bridge to lose its config space, so
 * all the bus mappings and such are preserved.
 *
-* The PCI layer handles standard PCI registers like the
-* command register and BARs, but cbb-specific registers are
-* handled here.
+* For most drivers, the PCI layer handles this saving. However, since
+* there's much black magic and arcane art hidden in these few lines of
+* code that would be difficult to transition into the PCI
+* layer. chipinit was several years of trial and error to write.
 */
+   pci_write_config(brdev, CBBR_SOCKBASE, rman_get_start(sc-base_res), 4);
+   DEVPRINTF((brdev, PCI Memory allocated: %08lx\n,
+   rman_get_start(sc-base_res)));
+
sc-chipinit(sc);
 
/* reset interrupt -- Do we really need to do this? */

Modified: stable/10/sys/dev/pci/pci.c
==
--- stable/10/sys/dev/pci/pci.c Fri Jul 24 22:13:39 2015(r285862)
+++ stable/10/sys/dev/pci/pci.c Sat Jul 25 00:14:02 2015(r285863)
@@ -590,19 +590,9 @@ pci_hdrtypedata(device_t pcib, int b, in
cfg-nummaps= PCI_MAXMAPS_0;
break;
case PCIM_HDRTYPE_BRIDGE:
-   cfg-bridge.br_seclat = REG(PCIR_SECLAT_1, 1);
-   cfg-bridge.br_subbus = REG(PCIR_SUBBUS_1, 1);
-   cfg-bridge.br_secbus = REG(PCIR_SECBUS_1, 1);
-   cfg-bridge.br_pribus = REG(PCIR_PRIBUS_1, 1);
-   cfg-bridge.br_control = REG(PCIR_BRIDGECTL_1, 2);
cfg-nummaps