svn commit: r344479 - head/sys/mips/conf

2019-02-22 Thread Maxim Sobolev
Author: sobomax
Date: Sat Feb 23 00:00:49 2019
New Revision: 344479
URL: https://svnweb.freebsd.org/changeset/base/344479

Log:
  o Get rid of silly comment which seems to have got life of its own via
copy-and-paste process;
  
  o Return geom_uzip(4) usage back to how manual page prescribes it to be
used while I am here.

Modified:
  head/sys/mips/conf/AP94
  head/sys/mips/conf/DIR-825B1
  head/sys/mips/conf/ROUTERSTATION_MFS
  head/sys/mips/conf/RSPRO_MFS
  head/sys/mips/conf/WZR-300HP
  head/sys/mips/conf/WZR-HPAG300H

Modified: head/sys/mips/conf/AP94
==
--- head/sys/mips/conf/AP94 Fri Feb 22 23:15:32 2019(r344478)
+++ head/sys/mips/conf/AP94 Sat Feb 23 00:00:49 2019(r344479)
@@ -21,7 +21,6 @@ hints "AP94.hints"
 
 # GEOM modules
 device geom_redboot# to get access to the SPI flash partitions
-device geom_uzip   # compressed in-memory filesystem hackery!
 optionsGEOM_UZIP
 
 optionsROOTDEVNAME=\"ufs:md0.uzip\"

Modified: head/sys/mips/conf/DIR-825B1
==
--- head/sys/mips/conf/DIR-825B1Fri Feb 22 23:15:32 2019
(r344478)
+++ head/sys/mips/conf/DIR-825B1Sat Feb 23 00:00:49 2019
(r344479)
@@ -47,7 +47,6 @@ nooptions INET6
 
 # GEOM modules
 device geom_map# to get access to the SPI flash partitions
-device geom_uzip   # compressed in-memory filesystem hackery!
 optionsGEOM_UZIP
 optionsGEOM_PART_GPT
 

Modified: head/sys/mips/conf/ROUTERSTATION_MFS
==
--- head/sys/mips/conf/ROUTERSTATION_MFSFri Feb 22 23:15:32 2019
(r344478)
+++ head/sys/mips/conf/ROUTERSTATION_MFSSat Feb 23 00:00:49 2019
(r344479)
@@ -12,7 +12,6 @@ hints "ROUTERSTATION.hints"
 
 # GEOM modules
 device geom_redboot# to get access to the SPI flash partitions
-device geom_uzip   # compressed in-memory filesystem hackery!
 optionsGEOM_UZIP
 
 optionsROOTDEVNAME=\"ufs:md0.uzip\"

Modified: head/sys/mips/conf/RSPRO_MFS
==
--- head/sys/mips/conf/RSPRO_MFSFri Feb 22 23:15:32 2019
(r344478)
+++ head/sys/mips/conf/RSPRO_MFSSat Feb 23 00:00:49 2019
(r344479)
@@ -15,7 +15,6 @@ devicepcf2123_rtc
 
 # GEOM modules
 device geom_redboot# to get access to the SPI flash partitions
-device geom_uzip   # compressed in-memory filesystem hackery!
 optionsGEOM_UZIP
 
 # Boot from the first MFS uzip

Modified: head/sys/mips/conf/WZR-300HP
==
--- head/sys/mips/conf/WZR-300HPFri Feb 22 23:15:32 2019
(r344478)
+++ head/sys/mips/conf/WZR-300HPSat Feb 23 00:00:49 2019
(r344479)
@@ -26,7 +26,7 @@ options   BOOTVERBOSE
 
 # GEOM modules
 device geom_map# to get access to the SPI flash partitions
-device geom_uzip   # compressed in-memory filesystem hackery!
+optionsGEOM_UZIP
 
 optionsROOTDEVNAME=\"ufs:/dev/map/rootfs.uzip\"
 

Modified: head/sys/mips/conf/WZR-HPAG300H
==
--- head/sys/mips/conf/WZR-HPAG300H Fri Feb 22 23:15:32 2019
(r344478)
+++ head/sys/mips/conf/WZR-HPAG300H Sat Feb 23 00:00:49 2019
(r344479)
@@ -25,7 +25,7 @@ options   AR71XX_ENV_UBOOT
 optionsBOOTVERBOSE
 
 # GEOM modules
-device geom_uzip   # compressed in-memory filesystem hackery!
+optionsGEOM_UZIP
 device geom_map# to get access to the SPI flash partitions
 
 optionsROOTDEVNAME=\"ufs:/dev/map/rootfs.uzip\"
___
svn-src-head@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 commit: r344478 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src kern sys

2019-02-22 Thread Matt Macy
Author: mmacy
Date: Fri Feb 22 23:15:32 2019
New Revision: 344478
URL: https://svnweb.freebsd.org/changeset/base/344478

Log:
  lkpi: allow late binding of linux_alloc_current
  
  Some consumers may be loosely coupled with the lkpi.
  This allows them to call linux_alloc_current without
  having a static dependency.
  
  Reviewed by:  hps@
  MFC after:1 week
  Sponsored by: iX Systems
  Differential Revision:https://reviews.freebsd.org/D19257

Modified:
  head/sys/compat/linuxkpi/common/include/linux/compat.h
  head/sys/compat/linuxkpi/common/src/linux_current.c
  head/sys/kern/init_main.c
  head/sys/sys/systm.h

Modified: head/sys/compat/linuxkpi/common/include/linux/compat.h
==
--- head/sys/compat/linuxkpi/common/include/linux/compat.h  Fri Feb 22 
21:57:27 2019(r344477)
+++ head/sys/compat/linuxkpi/common/include/linux/compat.h  Fri Feb 22 
23:15:32 2019(r344478)
@@ -41,18 +41,19 @@ struct task_struct;
 extern int linux_alloc_current(struct thread *, int flags);
 extern void linux_free_current(struct task_struct *);
 
+
 static inline void
 linux_set_current(struct thread *td)
 {
if (__predict_false(td->td_lkpi_task == NULL))
-   linux_alloc_current(td, M_WAITOK);
+   lkpi_alloc_current(td, M_WAITOK);
 }
 
 static inline int
 linux_set_current_flags(struct thread *td, int flags)
 {
if (__predict_false(td->td_lkpi_task == NULL))
-   return (linux_alloc_current(td, flags));
+   return (lkpi_alloc_current(td, flags));
return (0);
 }
 

Modified: head/sys/compat/linuxkpi/common/src/linux_current.c
==
--- head/sys/compat/linuxkpi/common/src/linux_current.c Fri Feb 22 21:57:27 
2019(r344477)
+++ head/sys/compat/linuxkpi/common/src/linux_current.c Fri Feb 22 23:15:32 
2019(r344478)
@@ -218,6 +218,7 @@ linux_get_pid_task(pid_t pid)
 static void
 linux_current_init(void *arg __unused)
 {
+   lkpi_alloc_current = linux_alloc_current;
linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
 }
@@ -242,7 +243,7 @@ linux_current_uninit(void *arg __unused)
PROC_UNLOCK(p);
}
sx_sunlock(_lock);
-
EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag);
+   lkpi_alloc_current = linux_alloc_current_noop;
 }
 SYSUNINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, 
linux_current_uninit, NULL);

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Fri Feb 22 21:57:27 2019(r344477)
+++ head/sys/kern/init_main.c   Fri Feb 22 23:15:32 2019(r344478)
@@ -107,6 +107,14 @@ struct thread0_storage thread0_st __aligned(32);
 struct vmspace vmspace0;
 struct proc *initproc;
 
+int
+linux_alloc_current_noop(struct thread *td __unused, int flags __unused)
+{
+   return (0);
+}
+int (*lkpi_alloc_current)(struct thread *, int) = linux_alloc_current_noop;
+
+
 #ifndef BOOTHOWTO
 #defineBOOTHOWTO   0
 #endif
@@ -454,7 +462,7 @@ proc0_init(void *dummy __unused)
GIANT_REQUIRED;
p = 
td = 
-   
+
/*
 * Initialize magic number and osrel.
 */

Modified: head/sys/sys/systm.h
==
--- head/sys/sys/systm.hFri Feb 22 21:57:27 2019(r344477)
+++ head/sys/sys/systm.hFri Feb 22 23:15:32 2019(r344478)
@@ -237,6 +237,13 @@ void   init_param2(long physpages);
 void   init_static_kenv(char *, size_t);
 void   tablefull(const char *);
 
+/*
+ * Allocate per-thread "current" state in the linuxkpi
+ */
+extern int (*lkpi_alloc_current)(struct thread *, int);
+int linux_alloc_current_noop(struct thread *, int);
+
+
 #if defined(KLD_MODULE) || defined(KTR_CRITICAL) || !defined(_KERNEL) || 
defined(GENOFFSET)
 #define critical_enter() critical_enter_KBI()
 #define critical_exit() critical_exit_KBI()
___
svn-src-head@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 commit: r344477 - in head/sys/dev/usb: . quirk

2019-02-22 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 22 21:57:27 2019
New Revision: 344477
URL: https://svnweb.freebsd.org/changeset/base/344477

Log:
  Add new USB quirk.
  
  PR:   235897
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Fri Feb 22 19:54:28 2019
(r344476)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Fri Feb 22 21:57:27 2019
(r344477)
@@ -396,6 +396,8 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
USB_QUIRK(SANDISK, SDCZ4_256, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
+   USB_QUIRK(SANDISK, SDCZ48_32, 0x, 0x, UQ_MSC_NO_SYNC_CACHE,
+   UQ_MSC_NO_TEST_UNIT_READY),
USB_QUIRK(SANDISK, SDDR31, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1),
USB_QUIRK(SANDISK, IMAGEMATE_SDDR289, 0x, 0x,

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsFri Feb 22 19:54:28 2019(r344476)
+++ head/sys/dev/usb/usbdevsFri Feb 22 21:57:27 2019(r344477)
@@ -4067,6 +4067,7 @@ product SANDISK SDCZ2_128 0x7100  Cruzer Mini 128MB
 product SANDISK SDCZ2_256  0x7104  Cruzer Mini 256MB
 product SANDISK SDCZ4_128  0x7112  Cruzer Micro 128MB
 product SANDISK SDCZ4_256  0x7113  Cruzer Micro 256MB
+product SANDISK SDCZ48_32  0x5581  Ultra 32GB
 product SANDISK IMAGEMATE_SDDR289  0xb6ba  ImageMate SDDR-289
 
 /* Sanwa Electric Instrument Co., Ltd. products */
___
svn-src-head@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 commit: r344476 - in head/sys: dev/nvdimm modules/nvdimm

2019-02-22 Thread Ben Widawsky
Author: bwidawsk
Date: Fri Feb 22 19:54:28 2019
New Revision: 344476
URL: https://svnweb.freebsd.org/changeset/base/344476

Log:
  nvdimm: Simple namespace support
  
  Add support for simple NVDIMM v1.2 namespaces from the UEFI
  version 2.7 specification. The combination of NVDIMM regions and
  labels can lead to a wide variety of namespace layouts. Here we
  support a simple subset of namespaces where each NVDIMM SPA range
  is composed of a single region per member dimm.
  
  Submitted by: D Scott Phillips 
  Discussed with:   kib
  MFC after:1 week
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D18736

Added:
  head/sys/dev/nvdimm/nvdimm_ns.c   (contents, props changed)
Modified:
  head/sys/dev/nvdimm/nvdimm.c
  head/sys/dev/nvdimm/nvdimm_var.h
  head/sys/modules/nvdimm/Makefile

Modified: head/sys/dev/nvdimm/nvdimm.c
==
--- head/sys/dev/nvdimm/nvdimm.cFri Feb 22 19:54:24 2019
(r344475)
+++ head/sys/dev/nvdimm/nvdimm.cFri Feb 22 19:54:28 2019
(r344476)
@@ -462,6 +462,7 @@ nvdimm_root_create_spas(struct nvdimm_root_dev *dev, A
free(spa, M_NVDIMM);
break;
}
+   nvdimm_create_namespaces(spa_mapping, nfitbl);
SLIST_INSERT_HEAD(>spas, spa_mapping, link);
}
free(spas, M_NVDIMM);
@@ -519,6 +520,7 @@ nvdimm_root_detach(device_t dev)
 
root = device_get_softc(dev);
SLIST_FOREACH_SAFE(spa, >spas, link, next) {
+   nvdimm_destroy_namespaces(spa);
nvdimm_spa_fini(spa);
SLIST_REMOVE_HEAD(>spas, link);
free(spa, M_NVDIMM);

Added: head/sys/dev/nvdimm/nvdimm_ns.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/nvdimm/nvdimm_ns.c Fri Feb 22 19:54:28 2019
(r344476)
@@ -0,0 +1,97 @@
+/*-
+ * Copyright (c) 2018 Intel Corporation
+ * 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, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+int
+nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI_TABLE_NFIT *nfitbl)
+{
+   ACPI_NFIT_MEMORY_MAP **regions;
+   struct nvdimm_dev *nv;
+   struct nvdimm_label_entry *e;
+   struct nvdimm_namespace *ns;
+   nfit_handle_t dimm_handle;
+   char *name;
+   int i, error, num_regions;
+
+   acpi_nfit_get_region_mappings_by_spa_range(nfitbl, spa->spa_nfit_idx,
+   , _regions);
+   if (num_regions == 0 || num_regions != regions[0]->InterleaveWays) {
+   free(regions, M_NVDIMM);
+   return (ENXIO);
+   }
+   dimm_handle = regions[0]->DeviceHandle;
+   nv = nvdimm_find_by_handle(dimm_handle);
+   if (nv == NULL) {
+   free(regions, M_NVDIMM);
+   return (ENXIO);
+   }
+   i = 0;
+   error = 0;
+   SLIST_FOREACH(e, >labels, link) {
+   ns = malloc(sizeof(struct nvdimm_namespace), M_NVDIMM,
+   M_WAITOK | M_ZERO);
+   ns->dev.spa_domain = spa->dev.spa_domain;
+   ns->dev.spa_phys_base = spa->dev.spa_phys_base +
+   regions[0]->RegionOffset +
+   num_regions *
+   (e->label.dimm_phys_addr - regions[0]->Address);
+   ns->dev.spa_len = num_regions * e->label.raw_size;
+   ns->dev.spa_efi_mem_flags = spa->dev.spa_efi_mem_flags;
+   

svn commit: r344474 - head/sys/dev/nvdimm

2019-02-22 Thread Ben Widawsky
Author: bwidawsk
Date: Fri Feb 22 19:54:21 2019
New Revision: 344474
URL: https://svnweb.freebsd.org/changeset/base/344474

Log:
  nvdimm: split spa dev into a separate entity
  
  Separate code for exposing a device backed by a system physical
  address range away from the NVDIMM spa code. This will allow a
  future patch to add support for NVDIMM namespaces while using the
  same device code.
  
  Submitted by: D Scott Phillips 
  Reviewed by:  bwidawsk
  MFC after:1 week
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D18736

Modified:
  head/sys/dev/nvdimm/nvdimm_spa.c
  head/sys/dev/nvdimm/nvdimm_var.h

Modified: head/sys/dev/nvdimm/nvdimm_spa.c
==
--- head/sys/dev/nvdimm/nvdimm_spa.cFri Feb 22 18:43:27 2019
(r344473)
+++ head/sys/dev/nvdimm/nvdimm_spa.cFri Feb 22 19:54:21 2019
(r344474)
@@ -143,31 +143,31 @@ nvdimm_spa_type_from_uuid(struct uuid *uuid)
 }
 
 static vm_memattr_t
-nvdimm_spa_memattr(struct SPA_mapping *spa)
+nvdimm_spa_memattr(struct nvdimm_spa_dev *dev)
 {
vm_memattr_t mode;
 
-   if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_WB) != 0)
+   if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_WB) != 0)
mode = VM_MEMATTR_WRITE_BACK;
-   else if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_WT) != 0)
+   else if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_WT) != 0)
mode = VM_MEMATTR_WRITE_THROUGH;
-   else if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_WC) != 0)
+   else if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_WC) != 0)
mode = VM_MEMATTR_WRITE_COMBINING;
-   else if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_WP) != 0)
+   else if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_WP) != 0)
mode = VM_MEMATTR_WRITE_PROTECTED;
-   else if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_UC) != 0)
+   else if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_UC) != 0)
mode = VM_MEMATTR_UNCACHEABLE;
else {
if (bootverbose)
-   printf("SPA%d mapping attr unsupported\n",
-   spa->spa_nfit_idx);
+   printf("SPA mapping attr %#lx unsupported\n",
+   dev->spa_efi_mem_flags);
mode = VM_MEMATTR_UNCACHEABLE;
}
return (mode);
 }
 
 static int
-nvdimm_spa_uio(struct SPA_mapping *spa, struct uio *uio)
+nvdimm_spa_uio(struct nvdimm_spa_dev *dev, struct uio *uio)
 {
struct vm_page m, *ma;
off_t off;
@@ -175,14 +175,14 @@ nvdimm_spa_uio(struct SPA_mapping *spa, struct uio *ui
int error, n;
 
error = 0;
-   if (spa->spa_kva == NULL) {
-   mattr = nvdimm_spa_memattr(spa);
+   if (dev->spa_kva == NULL) {
+   mattr = nvdimm_spa_memattr(dev);
vm_page_initfake(, 0, mattr);
ma = 
while (uio->uio_resid > 0) {
-   if (uio->uio_offset >= spa->spa_len)
+   if (uio->uio_offset >= dev->spa_len)
break;
-   off = spa->spa_phys_base + uio->uio_offset;
+   off = dev->spa_phys_base + uio->uio_offset;
vm_page_updatefake(, trunc_page(off), mattr);
n = PAGE_SIZE;
if (n > uio->uio_resid)
@@ -193,14 +193,14 @@ nvdimm_spa_uio(struct SPA_mapping *spa, struct uio *ui
}
} else {
while (uio->uio_resid > 0) {
-   if (uio->uio_offset >= spa->spa_len)
+   if (uio->uio_offset >= dev->spa_len)
break;
n = INT_MAX;
if (n > uio->uio_resid)
n = uio->uio_resid;
-   if (uio->uio_offset + n > spa->spa_len)
-   n = spa->spa_len - uio->uio_offset;
-   error = uiomove((char *)spa->spa_kva + uio->uio_offset,
+   if (uio->uio_offset + n > dev->spa_len)
+   n = dev->spa_len - uio->uio_offset;
+   error = uiomove((char *)dev->spa_kva + uio->uio_offset,
n, uio);
if (error != 0)
break;
@@ -217,20 +217,20 @@ nvdimm_spa_rw(struct cdev *dev, struct uio *uio, int i
 }
 
 static int
-nvdimm_spa_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
+nvdimm_spa_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
 struct thread *td)
 {
-   struct SPA_mapping *spa;
+   struct nvdimm_spa_dev *dev;
int error;
 
-   spa = dev->si_drv1;
+   dev = cdev->si_drv1;
error = 0;
switch (cmd) {
case DIOCGSECTORSIZE:
*(u_int *)data = DEV_BSIZE;
 

svn commit: r344475 - head/sys/dev/nvdimm

2019-02-22 Thread Ben Widawsky
Author: bwidawsk
Date: Fri Feb 22 19:54:24 2019
New Revision: 344475
URL: https://svnweb.freebsd.org/changeset/base/344475

Log:
  nvdimm: Read NVDIMM namespace labels
  
  When attaching to NVDIMM devices, read and verify the namespace
  labels from the special namespace label storage area. A later
  change will expose NVDIMM namespaces derived from this label data.
  
  Submitted by: D Scott Phillips 
  Discussed with:   kib
  MFC after:1 week
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D18735

Modified:
  head/sys/dev/nvdimm/nvdimm.c
  head/sys/dev/nvdimm/nvdimm_var.h

Modified: head/sys/dev/nvdimm/nvdimm.c
==
--- head/sys/dev/nvdimm/nvdimm.cFri Feb 22 19:54:21 2019
(r344474)
+++ head/sys/dev/nvdimm/nvdimm.cFri Feb 22 19:54:24 2019
(r344475)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,10 +52,240 @@ __FBSDID("$FreeBSD$");
 #define _COMPONENT ACPI_OEM
 ACPI_MODULE_NAME("NVDIMM")
 
+static struct uuid intel_nvdimm_dsm_uuid =
+{0x4309AC30,0x0D11,0x11E4,0x91,0x91,{0x08,0x00,0x20,0x0C,0x9A,0x66}};
+#define INTEL_NVDIMM_DSM_REV 1
+#define INTEL_NVDIMM_DSM_GET_LABEL_SIZE 4
+#define INTEL_NVDIMM_DSM_GET_LABEL_DATA 5
+
 static devclass_t nvdimm_devclass;
 static devclass_t nvdimm_root_devclass;
 MALLOC_DEFINE(M_NVDIMM, "nvdimm", "NVDIMM driver memory");
 
+static int
+read_label_area_size(struct nvdimm_dev *nv)
+{
+   ACPI_OBJECT *result_buffer;
+   ACPI_HANDLE handle;
+   ACPI_STATUS status;
+   ACPI_BUFFER result;
+   uint32_t *out;
+   int error;
+
+   handle = nvdimm_root_get_acpi_handle(nv->nv_dev);
+   if (handle == NULL)
+   return (ENODEV);
+   result.Length = ACPI_ALLOCATE_BUFFER;
+   result.Pointer = NULL;
+   status = acpi_EvaluateDSM(handle, (uint8_t *)_nvdimm_dsm_uuid,
+   INTEL_NVDIMM_DSM_REV, INTEL_NVDIMM_DSM_GET_LABEL_SIZE, NULL,
+   );
+   error = ENXIO;
+   if (ACPI_SUCCESS(status) && result.Pointer != NULL &&
+   result.Length >= sizeof(ACPI_OBJECT)) {
+   result_buffer = result.Pointer;
+   if (result_buffer->Type == ACPI_TYPE_BUFFER &&
+   result_buffer->Buffer.Length >= 12) {
+   out = (uint32_t *)result_buffer->Buffer.Pointer;
+   nv->label_area_size = out[1];
+   nv->max_label_xfer = out[2];
+   error = 0;
+   }
+   }
+   if (result.Pointer != NULL)
+   AcpiOsFree(result.Pointer);
+   return (error);
+}
+
+static int
+read_label_area(struct nvdimm_dev *nv, uint8_t *dest, off_t offset,
+off_t length)
+{
+   ACPI_BUFFER result;
+   ACPI_HANDLE handle;
+   ACPI_OBJECT params_pkg, params_buf, *result_buf;
+   ACPI_STATUS status;
+   uint32_t params[2];
+   off_t to_read;
+   int error;
+
+   error = 0;
+   handle = nvdimm_root_get_acpi_handle(nv->nv_dev);
+   if (offset < 0 || length <= 0 ||
+   offset + length > nv->label_area_size ||
+   handle == NULL)
+   return (ENODEV);
+   params_pkg.Type = ACPI_TYPE_PACKAGE;
+   params_pkg.Package.Count = 1;
+   params_pkg.Package.Elements = _buf;
+   params_buf.Type = ACPI_TYPE_BUFFER;
+   params_buf.Buffer.Length = sizeof(params);
+   params_buf.Buffer.Pointer = (UINT8 *)params;
+   while (length > 0) {
+   to_read = MIN(length, nv->max_label_xfer);
+   params[0] = offset;
+   params[1] = to_read;
+   result.Length = ACPI_ALLOCATE_BUFFER;
+   result.Pointer = NULL;
+   status = acpi_EvaluateDSM(handle,
+   (uint8_t *)_nvdimm_dsm_uuid, INTEL_NVDIMM_DSM_REV,
+   INTEL_NVDIMM_DSM_GET_LABEL_DATA, _pkg, );
+   if (ACPI_FAILURE(status) ||
+   result.Length < sizeof(ACPI_OBJECT) ||
+   result.Pointer == NULL) {
+   error = ENXIO;
+   break;
+   }
+   result_buf = (ACPI_OBJECT *)result.Pointer;
+   if (result_buf->Type != ACPI_TYPE_BUFFER ||
+   result_buf->Buffer.Pointer == NULL ||
+   result_buf->Buffer.Length != 4 + to_read ||
+   ((uint16_t *)result_buf->Buffer.Pointer)[0] != 0) {
+   error = ENXIO;
+   break;
+   }
+   bcopy(result_buf->Buffer.Pointer + 4, dest, to_read);
+   dest += to_read;
+   offset += to_read;
+   length -= to_read;
+   if (result.Pointer != NULL) {
+   AcpiOsFree(result.Pointer);
+   result.Pointer = NULL;
+   }
+   }
+ 

svn commit: r344473 - head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-02-22 Thread David Bright
Author: dab
Date: Fri Feb 22 18:43:27 2019
New Revision: 344473
URL: https://svnweb.freebsd.org/changeset/base/344473

Log:
  CID 1332000: Logically dead code in 
sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
  
  A pointer is first tested for NULL. If non-NULL, another pointer is
  set equal to the first. The second pointer is then checked for NULL
  and an error path taken if so. This second test and the associated
  path is dead code as the pointer value, having just been checked for
  NULL, cannot be NULL at this point. Remove the dead code.
  
  Reported by:  Coverity
  Reviewed by:  daniel.william.ryan_gmail.com, vangyzen
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D19165

Modified:
  head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c

Modified: head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
==
--- head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c   Fri Feb 22 
18:24:57 2019(r344472)
+++ head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c   Fri Feb 22 
18:43:27 2019(r344473)
@@ -1820,12 +1820,6 @@ tiNumOfLunIOCTLreq(
   break;
 }
 tdIORequestBody = (tdIORequestBody_t *)tiRequestBody;
-
-if(tdIORequestBody == agNULL)
-{
-  status = IOCTL_CALL_FAIL;
-  break;
-}
 tdIORequestBody->tiIORequest = tiIORequest;
 
 /* save context if we need to abort later */
___
svn-src-head@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"


Re: svn commit: r344099 - head/sys/net

2019-02-22 Thread John Baldwin
On 2/22/19 8:50 AM, Andrew Gallatin wrote:
> I think the misunderstanding here is that I think he's not getting the 
> ifp from the route.
> 
> My recollection is that he is holding the ifps when he enables HW pacing 
> in BBR.  Due to limitations in different NIC hardware, you can only have 
> N different rates, etc.  So he goes ahead and allocates those N rates up 
> front so that he knows he can reserve them & know that he can always get 
> them.
> 
> Then when the system reboots, BBR has an eventhandler that goes ahead 
> and frees those reservations.  I think that he's using the ifp that he's 
> holding here.
> 
> In the case that tripped him up, that ifp was lagg.
> 
> Your workaround would also work, but Randall does have a point about 
> symmetric alloc/free especially when viewed from his perspective,

But it's not really an alloc.  We have many other places in the kernel where
an alloc routine is actually a "forward" to something else that allocates the
real thing.  For example, when you add a kevent on a file descriptor, that is
routed to the 'file_filtops' in kern/kern_event.c, but that filtops only has
an attach routine, it doesn't have a detach routine because it's attach
routine is a forwarder to other filtops.  It invokes the fo_kqfilter method
that is responsible for setting up the right filtops to use.  For sockets
this routes to one of three filtops that all have detach methods but no
attach methods.  The way this is handled is that anytime a kevent is
detached, the current filtops is used to find the detach event handler.
We don't use the filter's type to get back to the original file_filtops and
require that to forward the detach request on to the real filtops.  Having
the tag save the "real" ifp is similar to knote's storing the real filtops.

Given your specific use case, it does seem that this commit is sufficient,
but it's not the "always works" way to free a tag, and it might be used as a
template that gets copied for use in another case where the extra guarantees
of this specific use case don't hold.  Given that I'd like to explore making
lagg and vlan allocate real interposing tags to handle TLS, this may prove
mostly academic as they would have "real" free routines then since their
alloc routines would just be forwarders.

-- 
John Baldwin


___
svn-src-head@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"


Re: svn commit: r344099 - head/sys/net

2019-02-22 Thread Andrew Gallatin
I think the misunderstanding here is that I think he's not getting the 
ifp from the route.


My recollection is that he is holding the ifps when he enables HW pacing 
in BBR.  Due to limitations in different NIC hardware, you can only have 
N different rates, etc.  So he goes ahead and allocates those N rates up 
front so that he knows he can reserve them & know that he can always get 
them.


Then when the system reboots, BBR has an eventhandler that goes ahead 
and frees those reservations.  I think that he's using the ifp that he's 
holding here.


In the case that tripped him up, that ifp was lagg.

Your workaround would also work, but Randall does have a point about 
symmetric alloc/free especially when viewed from his perspective,



Drew


___
svn-src-head@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 commit: r344470 - head/usr.sbin/newsyslog

2019-02-22 Thread David Bright
Author: dab
Date: Fri Feb 22 15:31:50 2019
New Revision: 344470
URL: https://svnweb.freebsd.org/changeset/base/344470

Log:
  Fix several Coverity-detected issues in newsyslog.
  
  - CID 1394815, CID 1305673: Dereference before null check - memory was
allocated and the allocation checked for NULL with a call to errx()
if it failed. Code below that was guaranteed that the pointer was
non-NULL, but there was another check for NULL at the exit of the
function (after the memory had already been referenced). Eliminate
the useless NULL check.
  
  - CID 1007452: Resource leak - Storage intended to be allocated and
returned to the caller was never freed. This was the result of a
regression in the function signature introduced in r208648 (2010)
(thanks for that find, @cem!). Fixed by altering the function
signature and passing the allocated memory to the caller as
intended. This also fixes PR158794.
  
  - CID 1008620: Logically dead code in newsyslog.c - This was a direct
result of CID 1007452. Since the memory allocated as described there
was not returned to the caller, a subsequent check for the memory
having been allocated was dead code. Returning the memory
re-animates the code that is the subject of this CID.
  
  - CID 1006131: Unused value - in parsing a configuration file, a
pointer to the end of the last field was saved, but not used after
that. Rewrite to use the pointer value. This could have been fixed
by avoiding the assignment altogether, but this solutions more
closely follows the pattern used in the preceding code.
  
  PR:   158794
  Reported by:  Coverity, Ken-ichi EZURA  (PR158794)
  Reviewed by:  cem, markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D19105

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

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Fri Feb 22 15:15:36 2019
(r344469)
+++ head/usr.sbin/newsyslog/newsyslog.c Fri Feb 22 15:31:50 2019
(r344470)
@@ -253,7 +253,7 @@ static const char *path_syslogpid = _PATH_SYSLOGPID;
 
 static struct cflist *get_worklist(char **files);
 static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
-   struct conf_entry *defconf_p, struct ilist *inclist);
+   struct conf_entry **defconf, struct ilist *inclist);
 static void add_to_queue(const char *fname, struct ilist *inclist);
 static char *sob(char *p);
 static char *son(char *p);
@@ -841,7 +841,7 @@ get_worklist(char **files)
 
if (verbose)
printf("Processing %s\n", inc->file);
-   parse_file(f, filelist, globlist, defconf, );
+   parse_file(f, filelist, globlist, , );
(void) fclose(f);
}
 
@@ -858,7 +858,6 @@ get_worklist(char **files)
if (defconf != NULL)
free_entry(defconf);
return (filelist);
-   /* NOTREACHED */
}
 
/*
@@ -915,7 +914,7 @@ get_worklist(char **files)
 * for a "glob" entry which does match.
 */
gmatch = 0;
-   if (verbose > 2 && globlist != NULL)
+   if (verbose > 2)
printf("\t+ Checking globs for %s\n", *given);
STAILQ_FOREACH(ent, globlist, cf_nextp) {
fnres = fnmatch(ent->log, *given, FNM_PATHNAME);
@@ -1046,7 +1045,7 @@ expand_globs(struct cflist *work_p, struct cflist *glo
  */
 static void
 parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
-struct conf_entry *defconf_p, struct ilist *inclist)
+struct conf_entry **defconf_p, struct ilist *inclist)
 {
char line[BUFSIZ], *parse, *q;
char *cp, *errline, *group;
@@ -1137,12 +1136,12 @@ parse_file(FILE *cf, struct cflist *work_p, struct cfl
working = init_entry(q, NULL);
if (strcasecmp(DEFAULT_MARKER, q) == 0) {
special = 1;
-   if (defconf_p != NULL) {
+   if (*defconf_p != NULL) {
warnx("Ignoring duplicate entry for %s!", q);
free_entry(working);
continue;
}
-   defconf_p = working;
+   *defconf_p = working;
}
 
q = parse = missing_field(sob(parse + 1), errline);
@@ -1357,7 +1356,8 @@ no_trimat:
q = NULL;
else {
q = parse = sob(parse + 1); /* Optional field */
-   *(parse = son(parse)) = '\0';
+   parse = son(parse);
+   *parse = '\0';
}
 

svn commit: r344469 - head/sbin/nvmecontrol

2019-02-22 Thread Warner Losh
Author: imp
Date: Fri Feb 22 15:15:36 2019
New Revision: 344469
URL: https://svnweb.freebsd.org/changeset/base/344469

Log:
  Rework logpage extensibility.
  
  Move from using a linker set to a constructor function that's
  called. This simplifies the code and is slightly more obvious.  We now
  keep a list of page decoders rather than having an array we managed
  before. Commands will move to something similar in the future.
  
  Reviewed by: jhb@
  Differential Revision: https://reviews.freebsd.org/D19275

Modified:
  head/sbin/nvmecontrol/logpage.c
  head/sbin/nvmecontrol/nvmecontrol.c
  head/sbin/nvmecontrol/nvmecontrol.h

Modified: head/sbin/nvmecontrol/logpage.c
==
--- head/sbin/nvmecontrol/logpage.c Fri Feb 22 14:59:40 2019
(r344468)
+++ head/sbin/nvmecontrol/logpage.c Fri Feb 22 15:15:36 2019
(r344469)
@@ -53,8 +53,15 @@ __FBSDID("$FreeBSD$");
 
 #define MAX_FW_SLOTS   (7)
 
-SET_CONCAT_DEF(logpage, struct logpage_function);
+static SLIST_HEAD(,logpage_function) logpages;
 
+void
+logpage_register(struct logpage_function *p)
+{
+
+SLIST_INSERT_HEAD(, p, link);
+}
+
 const char *
 kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key)
 {
@@ -326,15 +333,15 @@ NVME_LOGPAGE(fw,
 static void
 logpage_help(void)
 {
-   const struct logpage_function   * const *f;
+   const struct logpage_function   *f;
const char  *v;
 
fprintf(stderr, "\n");
fprintf(stderr, "%-8s %-10s %s\n", "Page", "Vendor","Page Name");
fprintf(stderr, " -- --\n");
-   for (f = logpage_begin(); f < logpage_limit(); f++) {
-   v = (*f)->vendor == NULL ? "-" : (*f)->vendor;
-   fprintf(stderr, "0x%02x %-10s %s\n", (*f)->log_page, v, 
(*f)->name);
+   SLIST_FOREACH(f, , link) {
+   v = f->vendor == NULL ? "-" : f->vendor;
+   fprintf(stderr, "0x%02x %-10s %s\n", f->log_page, v, 
f->name);
}
 
exit(1);
@@ -352,7 +359,7 @@ logpage(const struct nvme_function *nf, int argc, char
uint32_tnsid, size;
void*buf;
const char  *vendor = NULL;
-   const struct logpage_function   * const *f;
+   const struct logpage_function   *f;
struct nvme_controller_data cdata;
print_fn_t  print_fn;
uint8_t ns_smart;
@@ -438,14 +445,14 @@ logpage(const struct nvme_function *nf, int argc, char
 * the page is vendor specific, don't match the print function
 * unless the vendors match.
 */
-   for (f = logpage_begin(); f < logpage_limit(); f++) {
-   if ((*f)->vendor != NULL && vendor != NULL &&
-   strcmp((*f)->vendor, vendor) != 0)
+   SLIST_FOREACH(f, , link) {
+   if (f->vendor != NULL && vendor != NULL &&
+   strcmp(f->vendor, vendor) != 0)
continue;
-   if (log_page != (*f)->log_page)
+   if (log_page != f->log_page)
continue;
-   print_fn = (*f)->print_fn;
-   size = (*f)->size;
+   print_fn = f->print_fn;
+   size = f->size;
break;
}
}

Modified: head/sbin/nvmecontrol/nvmecontrol.c
==
--- head/sbin/nvmecontrol/nvmecontrol.c Fri Feb 22 14:59:40 2019
(r344468)
+++ head/sbin/nvmecontrol/nvmecontrol.c Fri Feb 22 15:15:36 2019
(r344469)
@@ -312,19 +312,17 @@ load_dir(const char *dir)
warnx("Can't load %s: %s", path, dlerror());
else {
/*
-* Add in the top (for cli commands) and logpage (for
-* logpage parsing) linker sets. We have to do this by
-* hand because linker sets aren't automatically merged.
+* Add in the top (for cli commands)linker sets. We have
+* to do this by hand because linker sets aren't
+* automatically merged.
 */
void *begin, *limit;
+
begin = dlsym(h, "__start_set_top");
limit = dlsym(h, "__stop_set_top");
if (begin)
add_to_top(begin, limit);
-   begin = dlsym(h, "__start_set_logpage");
-   limit = dlsym(h, "__stop_set_logpage");
-   if (begin)
-   add_to_logpage(begin, 

Re: svn commit: r344468 - head/usr.sbin/newsyslog

2019-02-22 Thread Bruce Evans

On Fri, 22 Feb 2019, David Bright wrote:


Log:
 Revert r344389 & r343906 - Fix Coverity errors in newsyslog

 It was pointed out that a couple of the "memory leak" CIDs that I
 fixed were arguably Coverity errors rather than errors in the
 newsyslog code and the cure was worse than the disease. Revert both
 changes. The first change, which included fixes for other Coverity
 errors, will be re-worked to omit the troublesome changes and then
 re-committed with the remaining fixes.

 Reported by:   bde
 Sponsored by:  Dell EMC Isilon


Thanks.  The other changes look OK.

Bruce
___
svn-src-head@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"


Re: svn commit: r344389 - head/usr.sbin/newsyslog

2019-02-22 Thread David Bright
[… other discussion omitted…] 

On Feb 21, 2019, at 12:22 PM, John Baldwin  wrote:
> 
> 
> I'm +1 on Bruce's point on this.  I find it similar to the recent spate of
> adding pointless '__dead2' annotations to usage functions that unconditionally
> call exit() (and thus are already inferred as __dead2 by any compiler
> written in this millenium)

I’ve reverted (r344468) the two commits that contained the memory leak fixes at 
issue. 

Thanks for the feedback.


-- 
David Bright
d...@freebsd.org


___
svn-src-head@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 commit: r344468 - head/usr.sbin/newsyslog

2019-02-22 Thread David Bright
Author: dab
Date: Fri Feb 22 14:59:40 2019
New Revision: 344468
URL: https://svnweb.freebsd.org/changeset/base/344468

Log:
  Revert r344389 & r343906 - Fix Coverity errors in newsyslog
  
  It was pointed out that a couple of the "memory leak" CIDs that I
  fixed were arguably Coverity errors rather than errors in the
  newsyslog code and the cure was worse than the disease. Revert both
  changes. The first change, which included fixes for other Coverity
  errors, will be re-worked to omit the troublesome changes and then
  re-committed with the remaining fixes.
  
  Reported by:  bde
  Sponsored by: Dell EMC Isilon

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

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Fri Feb 22 12:27:25 2019
(r344467)
+++ head/usr.sbin/newsyslog/newsyslog.c Fri Feb 22 14:59:40 2019
(r344468)
@@ -253,7 +253,7 @@ static const char *path_syslogpid = _PATH_SYSLOGPID;
 
 static struct cflist *get_worklist(char **files);
 static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
-   struct conf_entry **defconf, struct ilist *inclist);
+   struct conf_entry *defconf_p, struct ilist *inclist);
 static void add_to_queue(const char *fname, struct ilist *inclist);
 static char *sob(char *p);
 static char *son(char *p);
@@ -374,8 +374,6 @@ main(int argc, char **argv)
 
while (wait(NULL) > 0 || errno == EINTR)
;
-   free(timefnamefmt);
-   free(requestor);
return (0);
 }
 
@@ -793,9 +791,6 @@ usage(void)
fprintf(stderr,
"usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f 
config_file]\n"
" [-S pidfile] [-t timefmt] [[-R tagname] file 
...]\n");
-   /* Free global dynamically-allocated storage. */
-   free(timefnamefmt);
-   free(requestor);
exit(1);
 }
 
@@ -846,7 +841,7 @@ get_worklist(char **files)
 
if (verbose)
printf("Processing %s\n", inc->file);
-   parse_file(f, filelist, globlist, , );
+   parse_file(f, filelist, globlist, defconf, );
(void) fclose(f);
}
 
@@ -863,6 +858,7 @@ get_worklist(char **files)
if (defconf != NULL)
free_entry(defconf);
return (filelist);
+   /* NOTREACHED */
}
 
/*
@@ -919,7 +915,7 @@ get_worklist(char **files)
 * for a "glob" entry which does match.
 */
gmatch = 0;
-   if (verbose > 2)
+   if (verbose > 2 && globlist != NULL)
printf("\t+ Checking globs for %s\n", *given);
STAILQ_FOREACH(ent, globlist, cf_nextp) {
fnres = fnmatch(ent->log, *given, FNM_PATHNAME);
@@ -1050,7 +1046,7 @@ expand_globs(struct cflist *work_p, struct cflist *glo
  */
 static void
 parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
-struct conf_entry **defconf_p, struct ilist *inclist)
+struct conf_entry *defconf_p, struct ilist *inclist)
 {
char line[BUFSIZ], *parse, *q;
char *cp, *errline, *group;
@@ -1141,12 +1137,12 @@ parse_file(FILE *cf, struct cflist *work_p, struct cfl
working = init_entry(q, NULL);
if (strcasecmp(DEFAULT_MARKER, q) == 0) {
special = 1;
-   if (*defconf_p != NULL) {
+   if (defconf_p != NULL) {
warnx("Ignoring duplicate entry for %s!", q);
free_entry(working);
continue;
}
-   *defconf_p = working;
+   defconf_p = working;
}
 
q = parse = missing_field(sob(parse + 1), errline);
@@ -1361,8 +1357,7 @@ no_trimat:
q = NULL;
else {
q = parse = sob(parse + 1); /* Optional field */
-   parse = son(parse);
-   *parse = '\0';
+   *(parse = son(parse)) = '\0';
}
 
working->sig = SIGHUP;
@@ -2015,6 +2010,7 @@ do_zipwork(struct zipwork_entry *zwork)
const char **args, *pgm_name, *pgm_path;
char *zresult;
 
+   command = NULL;
assert(zwork != NULL);
assert(zwork->zw_conf != NULL);
assert(zwork->zw_conf->compress > COMPRESS_NONE);
@@ -2118,7 +2114,8 @@ do_zipwork(struct zipwork_entry *zwork)
change_attrs(zresult, zwork->zw_conf);
 
 out:
-   sbuf_delete(command);
+   if (command != NULL)
+   sbuf_delete(command);
free(args);
free(zresult);
 }
___

svn commit: r344464 - head/sys/conf

2019-02-22 Thread Bruce Evans
Author: bde
Date: Fri Feb 22 11:52:40 2019
New Revision: 344464
URL: https://svnweb.freebsd.org/changeset/base/344464

Log:
  Quick fix for building LINT on i386.  A fix is needed on all arches and
  this one should also work on amd64 and sparc64.
  
  LINT was broken in r312910 with the removal of pc98 support, by changing
  the pathname in UKBD_DFLT_KEYBAP from a removed pc98 file to a nonexistent
  file.
  
  There are many bugs nearby.  Some are:
  - the error is not properly detected and handled by make(1), because
kbdcontrol(8) exits with status 0 after failing to find the keymap file
  - UKBD_DFLT_KEYBAP is supposed to be MI, and is in MI NOTES to try enforce
this, but 5 out of 8 arches don't support it
  - LINT seems to have been broken by this in only 7 out of 8 arches.  mips
breaks test coverage instead, by killing this option in its MD NOTES.
arm kills ukbd but that is not enough to configure an unsupported option
used only by ukbd.

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Fri Feb 22 10:06:34 2019(r344463)
+++ head/sys/conf/NOTES Fri Feb 22 11:52:40 2019(r344464)
@@ -2740,7 +2740,7 @@ options   U3G_DEBUG
 
 # options for ukbd:
 optionsUKBD_DFLT_KEYMAP# specify the built-in keymap
-makeoptionsUKBD_DFLT_KEYMAP=jp
+makeoptionsUKBD_DFLT_KEYMAP=jp.106
 
 # options for uplcom:
 optionsUPLCOM_INTR_INTERVAL=100# interrupt pipe interval
___
svn-src-head@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"