CVS commit: src/sys/arch/evbarm/cubie

2014-04-17 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 18 06:53:13 UTC 2014

Modified Files:
src/sys/arch/evbarm/cubie: cubie_machdep.c cubie_start.S

Log Message:
Use KERNEL_BASE_VOFFSET.  s/bbs/bss
Move temp_l1_table to last 16KB before 128mb after kernel_base.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbarm/cubie/cubie_machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/cubie/cubie_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/cubie/cubie_machdep.c
diff -u src/sys/arch/evbarm/cubie/cubie_machdep.c:1.16 src/sys/arch/evbarm/cubie/cubie_machdep.c:1.17
--- src/sys/arch/evbarm/cubie/cubie_machdep.c:1.16	Fri Apr 11 04:19:48 2014
+++ src/sys/arch/evbarm/cubie/cubie_machdep.c	Fri Apr 18 06:53:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cubie_machdep.c,v 1.16 2014/04/11 04:19:48 matt Exp $ */
+/*	$NetBSD: cubie_machdep.c,v 1.17 2014/04/18 06:53:13 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cubie_machdep.c,v 1.16 2014/04/11 04:19:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cubie_machdep.c,v 1.17 2014/04/18 06:53:13 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -194,7 +194,7 @@ char *boot_file = NULL;
 bool cubietruck_p;
 /*
  * uboot_args are filled in by cubie_start.S and must be in .data
- * and not .bbs since .bss is cleared after uboot_args are filled in.
+ * and not .bss since .bss is cleared after uboot_args are filled in.
  */
 uintptr_t uboot_args[4] = { 0 };
 
@@ -216,11 +216,6 @@ int use_fb_console = true;
  * kernel address space.  *Not* for general use.
  */
 #define KERNEL_BASE_PHYS	((paddr_t)KERNEL_BASE_phys)
-#ifdef KERNEL_BASES_EQUAL
-#define KERNEL_PHYS_VOFFSET	0
-#else
-#define KERNEL_PHYS_VOFFSET	(KERNEL_BASE - AWIN_SDRAM_PBASE)
-#endif
 #define AWIN_CORE_VOFFSET	(AWIN_CORE_VBASE - AWIN_CORE_PBASE)
 
 /* Prototypes */
@@ -405,7 +400,7 @@ initarm(void *arg)
 		 */
 		if (uboot_args[3] - AWIN_SDRAM_PBASE < ram_size) {
 			const char * const args = (const char *)
-			 (uboot_args[3] + KERNEL_PHYS_VOFFSET);
+			 (uboot_args[3] + KERNEL_BASE_VOFFSET);
 			strlcpy(bootargs, args, sizeof(bootargs));
 		}
 	}

Index: src/sys/arch/evbarm/cubie/cubie_start.S
diff -u src/sys/arch/evbarm/cubie/cubie_start.S:1.8 src/sys/arch/evbarm/cubie/cubie_start.S:1.9
--- src/sys/arch/evbarm/cubie/cubie_start.S:1.8	Fri Apr 11 04:19:48 2014
+++ src/sys/arch/evbarm/cubie/cubie_start.S	Fri Apr 18 06:53:13 2014
@@ -40,11 +40,11 @@
 #include 
 #include   
 
-RCSID("$NetBSD: cubie_start.S,v 1.8 2014/04/11 04:19:48 matt Exp $")
+RCSID("$NetBSD: cubie_start.S,v 1.9 2014/04/18 06:53:13 matt Exp $")
 
 #if defined(VERBOSE_INIT_ARM)
 #define	XPUTC(n)	mov r0, n; bl xputc
-#ifdef KERNEL_BASES_EQUAL
+#if KERNEL_BASE_VOFFSET == 0
 #define	XPUTC2(n)	mov r0, n; bl xputc
 #else
 #define XPUTC2(n)	mov r0, n; blx r11
@@ -60,7 +60,7 @@ RCSID("$NetBSD: cubie_start.S,v 1.8 2014
 #endif
 
 #define INIT_MEMSIZE	128
-#define	TEMP_L1_TABLE	(AWIN_SDRAM_PBASE + INIT_MEMSIZE * 0x10 - L1_TABLE_SIZE)
+#define	TEMP_L1_TABLE	(KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * L1_S_SIZE - L1_TABLE_SIZE)
 
 #define	MD_CPU_HATCH	_C_LABEL(awin_cpu_hatch)
 
@@ -90,7 +90,7 @@ _C_LABEL(cubie_start):
 	 */
 	movw	r4, #:lower16:uboot_args
 	movt	r4, #:upper16:uboot_args
-#ifndef KERNEL_BASES_EQUAL
+#if KERNEL_BASE_VOFFSET != 0
 	/*
 	 * But since .start is at 0x4000 and .text is at 0x800, we
 	 * can't directly use the address that the linker gave us directly.
@@ -123,7 +123,7 @@ _C_LABEL(cubie_start):
 	 */
 	movw	r0, #:lower16:TEMP_L1_TABLE
 	movt	r0, #:upper16:TEMP_L1_TABLE
-#ifdef KERNEL_BASES_EQUAL
+#if KERNEL_BASE_VOFFSET == 0
 	bl	arm_cpuinit
 #else
 	/*
@@ -131,7 +131,7 @@ _C_LABEL(cubie_start):
 	 * so setup the lr to be in .text.  Cache the address for xputc
 	 * before we go.
 	 */
-#ifdef VERBOSE_INIT_ARM
+#if defined(VERBOSE_INIT_ARM)
 	adr	r11, xputc		@ for XPUTC2
 #endif
 	movw	lr, #:lower16:1f
@@ -252,19 +252,11 @@ ASEND(a20_mpinit)
 #endif /* MULTIPROCESSOR */
 
 .Lmmu_init_table:
-#ifdef KERNEL_BASES_EQUAL
-	/* Map memory 1:1 VA to PA, write-back cacheable, shareable */
-	MMU_INIT(KERNEL_BASE, KERNEL_BASE, INIT_MEMSIZE,
-		L1_S_PROTO_armv7 | L1_S_APv7_KRW | L1_S_CACHEABLE)
-
-	/* Map temp L1 table 1:1 VA to PA, write-back cacheable, shareable */
-	MMU_INIT(TEMP_L1_TABLE, TEMP_L1_TABLE, INIT_MEMSIZE,
-		L1_S_PROTO_armv7 | L1_S_APv7_KRW | L1_S_CACHEABLE)
-#else
 	/* Map KERNEL_BASE VA to SDRAM PA, write-back cacheable, shareable */
 	MMU_INIT(KERNEL_BASE, KERNEL_BASE - KERNEL_BASE_VOFFSET, INIT_MEMSIZE,
 		L1_S_PROTO_armv7 | L1_S_APv7_KRW | L1_S_CACHEABLE)
 
+#if KERNEL_BASE_VOFFSET != 0
 	/* Map memory 1:1 VA to PA, write-back cacheable, shareable */
 	MMU_INIT(KERNEL_BASE - KERNEL_BASE_VOFFSET,
 		KERNEL_BASE - KERNEL_BASE_

CVS commit: src/sys/dev/scsipi

2014-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 18 06:23:32 UTC 2014

Modified Files:
src/sys/dev/scsipi: cd.c

Log Message:
Fix PR kern/48550 by aligning the single instance of scsipi_read_cd_cap_data
that we found misaligned in the wild so far properly for the ahcisata
driver. Also point at PR kern/48754 for the real issue.


To generate a diff of this commit:
cvs rdiff -u -r1.318 -r1.319 src/sys/dev/scsipi/cd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.318 src/sys/dev/scsipi/cd.c:1.319
--- src/sys/dev/scsipi/cd.c:1.318	Wed Mar 19 15:48:23 2014
+++ src/sys/dev/scsipi/cd.c	Fri Apr 18 06:23:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.318 2014/03/19 15:48:23 martin Exp $	*/
+/*	$NetBSD: cd.c,v 1.319 2014/04/18 06:23:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.318 2014/03/19 15:48:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.319 2014/04/18 06:23:32 martin Exp $");
 
 #include 
 #include 
@@ -1807,7 +1807,12 @@ static int
 read_cd_capacity(struct scsipi_periph *periph, u_int *blksize, u_long *last_lba)
 {
 	struct scsipi_read_cd_capacitycap_cmd;
-	struct scsipi_read_cd_cap_datacap;
+	/*
+	 * XXX: see PR 48550 and PR 48754:
+	 * the ahcisata(4) driver can not deal with unaligned
+	 * data, so align this "a bit"
+	 */
+	struct scsipi_read_cd_cap_datacap __aligned(2);
 	struct scsipi_read_discinfo   di_cmd;
 	struct scsipi_read_discinfo_data  di;
 	struct scsipi_read_trackinfo  ti_cmd;



CVS commit: src/sys/kern

2014-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Apr 18 05:22:13 UTC 2014

Modified Files:
src/sys/kern: vfs_syscalls.c

Log Message:
Memory leak (only triggerable from root).

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.480 -r1.481 src/sys/kern/vfs_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.480 src/sys/kern/vfs_syscalls.c:1.481
--- src/sys/kern/vfs_syscalls.c:1.480	Wed Apr 16 19:25:28 2014
+++ src/sys/kern/vfs_syscalls.c	Fri Apr 18 05:22:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.480 2014/04/16 19:25:28 maxv Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.481 2014/04/18 05:22:13 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.480 2014/04/16 19:25:28 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.481 2014/04/18 05:22:13 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1981,6 +1981,7 @@ dofhopen(struct lwp *l, const void *ufhp
 		goto bad;
 	}
 	error = vfs_fhtovp(fh, &vp);
+	vfs_copyinfh_free(fh);
 	if (error != 0) {
 		goto bad;
 	}
@@ -2018,14 +2019,12 @@ dofhopen(struct lwp *l, const void *ufhp
 	VOP_UNLOCK(vp);
 	*retval = indx;
 	fd_affix(p, fp, indx);
-	vfs_copyinfh_free(fh);
 	return (0);
 
 bad:
 	fd_abort(p, fp, indx);
 	if (vp != NULL)
 		vput(vp);
-	vfs_copyinfh_free(fh);
 	return (error);
 }
 



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 02:41:32 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: scan.l

Log Message:
remove attribute keyword


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/xlint/lint1/scan.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.56 src/usr.bin/xlint/lint1/scan.l:1.57
--- src/usr.bin/xlint/lint1/scan.l:1.56	Thu Apr 17 21:39:57 2014
+++ src/usr.bin/xlint/lint1/scan.l	Thu Apr 17 22:41:32 2014
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.56 2014/04/18 01:39:57 christos Exp $ */
+/* $NetBSD: scan.l,v 1.57 2014/04/18 02:41:32 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.56 2014/04/18 01:39:57 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.57 2014/04/18 02:41:32 christos Exp $");
 #endif
 
 #include 
@@ -203,7 +203,6 @@ static	struct	kwtab {
 } kwtab[] = {
 	{ "__alignof__", T_ALIGNOF,	0,	0,	0,	  0, 0, 0, 0 },
 	{ "__attribute__",T_ATTRIBUTE,	0,	0,	0,	  0, 0, 1, 0 },
-	{ "attribute",	T_ATTRIBUTE,	0,	0,	0,	  0, 0, 1, 0 },
 	{ "__packed__",	T_AT_PACKED,	0,	0,	0,	  0, 0, 1, 1 },
 	{ "packed",	T_AT_PACKED,	0,	0,	0,	  0, 0, 1, 1 },
 	{ "__aligned__",T_AT_ALIGNED,	0,	0,	0,	  0, 0, 1, 1 },



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 02:41:17 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
handle constant attribute


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/lint1/cgram.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.61 src/usr.bin/xlint/lint1/cgram.y:1.62
--- src/usr.bin/xlint/lint1/cgram.y:1.61	Thu Apr 17 20:23:46 2014
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Apr 17 22:41:17 2014
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.61 2014/04/18 00:23:46 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.62 2014/04/18 02:41:17 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.61 2014/04/18 00:23:46 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.62 2014/04/18 02:41:17 christos Exp $");
 #endif
 
 #include 
@@ -495,6 +495,10 @@ type_attribute_spec:
 	| T_AT_FORMAT T_LPARN type_attribute_format_type T_COMMA
 	constant T_COMMA constant T_RPARN
 	| T_AT_UNUSED
+	| T_QUAL {
+		if ($1 != CONST)	
+			yyerror("Bad attribute");
+	}
 	;
 
 type_attribute:



CVS commit: src/external/bsd/elftoolchain/dist/libelf

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 02:28:06 UTC 2014

Modified Files:
src/external/bsd/elftoolchain/dist/libelf: libelf_align.c

Log Message:
lint has __alignof__ too.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/elftoolchain/dist/libelf/libelf_align.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/elftoolchain/dist/libelf/libelf_align.c
diff -u src/external/bsd/elftoolchain/dist/libelf/libelf_align.c:1.2 src/external/bsd/elftoolchain/dist/libelf/libelf_align.c:1.3
--- src/external/bsd/elftoolchain/dist/libelf/libelf_align.c:1.2	Sun Mar  9 12:58:04 2014
+++ src/external/bsd/elftoolchain/dist/libelf/libelf_align.c	Thu Apr 17 22:28:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_align.c,v 1.2 2014/03/09 16:58:04 christos Exp $	*/
+/*	$NetBSD: libelf_align.c,v 1.3 2014/04/18 02:28:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006,2008 Joseph Koshy
@@ -38,7 +38,7 @@
 
 #include "_libelf.h"
 
-__RCSID("$NetBSD: libelf_align.c,v 1.2 2014/03/09 16:58:04 christos Exp $");
+__RCSID("$NetBSD: libelf_align.c,v 1.3 2014/04/18 02:28:06 christos Exp $");
 ELFTC_VCSID("Id: libelf_align.c 2225 2011-11-26 18:55:54Z jkoshy ");
 
 struct align {
@@ -46,7 +46,7 @@ struct align {
 	int a64;
 };
 
-#ifdef	__GNUC__
+#if defined(__GNUC__) || defined(__lint__)
 #define	MALIGN(N)	{	\
 		.a32 = __alignof__(Elf32_##N),			\
 		.a64 = __alignof__(Elf64_##N)			\



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 02:17:14 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: main1.c

Log Message:
don't include fmemopen in tools builds. Since tools does not define
_NETBSD_SOURCE, we don't get the fmemopen prototype


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/lint1/main1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/main1.c
diff -u src/usr.bin/xlint/lint1/main1.c:1.23 src/usr.bin/xlint/lint1/main1.c:1.24
--- src/usr.bin/xlint/lint1/main1.c:1.23	Thu Apr 17 21:18:54 2014
+++ src/usr.bin/xlint/lint1/main1.c	Thu Apr 17 22:17:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main1.c,v 1.23 2014/04/18 01:18:54 christos Exp $	*/
+/*	$NetBSD: main1.c,v 1.24 2014/04/18 02:17:14 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.23 2014/04/18 01:18:54 christos Exp $");
+__RCSID("$NetBSD: main1.c,v 1.24 2014/04/18 02:17:14 christos Exp $");
 #endif
 
 #include 
@@ -128,7 +128,7 @@ sig_atomic_t fpe;
 
 static	void	usage(void);
 
-#ifdef __NetBSD__
+#if !HAVE_NBTOOL_CONFIG_H
 static const char builtins[] =
 "int __builtin_isinf(long double);\n"
 "int __builtin_isnan(long double);\n"
@@ -222,7 +222,7 @@ main(int argc, char *argv[])
 	initscan();
 	initmtab();
 
-#ifdef __NetBSD__
+#if !HAVE_NBTOOL_CONFIG_H
 	if ((yyin = fmemopen(__UNCONST(builtins), sizeof(builtins) - 1, "r"))
 	== NULL)
 		err(1, "cannot open builtins");



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 01:39:57 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: scan.l

Log Message:
Never return the attribute keywords if we are not in attribute.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/xlint/lint1/scan.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.55 src/usr.bin/xlint/lint1/scan.l:1.56
--- src/usr.bin/xlint/lint1/scan.l:1.55	Thu Apr 17 20:23:46 2014
+++ src/usr.bin/xlint/lint1/scan.l	Thu Apr 17 21:39:57 2014
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.55 2014/04/18 00:23:46 christos Exp $ */
+/* $NetBSD: scan.l,v 1.56 2014/04/18 01:39:57 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.55 2014/04/18 00:23:46 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.56 2014/04/18 01:39:57 christos Exp $");
 #endif
 
 #include 
@@ -444,11 +444,8 @@ name(void)
 	sb->sb_len = yyleng;
 	sb->sb_hash = hash(yytext);
 	if ((sym = search(sb)) != NULL && sym->s_keyw) {
-		struct kwtab *kw = sym->s_keyw;
-		if (!kw->kw_attr || attron) {
-			freesb(sb);
-			return (keyw(sym));
-		}
+		freesb(sb);
+		return (keyw(sym));
 	}
 
 	sb->sb_sym = sym;
@@ -478,8 +475,12 @@ search(sbuf_t *sb)
 
 	for (sym = symtab[sb->sb_hash]; sym != NULL; sym = sym->s_link) {
 		if (strcmp(sym->s_name, sb->sb_name) == 0) {
-			if (sym->s_keyw || sym->s_kind == symtyp)
-return (sym);
+			if (sym->s_keyw) {
+struct kwtab *kw = sym->s_keyw;
+if (!kw->kw_attr || attron)
+	return (sym);
+			} else if (sym->s_kind == symtyp)
+return sym;
 		}
 	}
 
@@ -1387,7 +1388,7 @@ getsym(sbuf_t *sb)
 
 	if (sym != NULL) {
 		if (sym->s_kind != symtyp)
-			LERROR("storesym()");
+			LERROR("storesym(%d, %d)", sym->s_kind, symtyp);
 		symtyp = FVFT;
 		freesb(sb);
 		return (sym);



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 01:18:54 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: main1.c

Log Message:
builtins only for NetBSD since fmemopen is not portable.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/lint1/main1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/main1.c
diff -u src/usr.bin/xlint/lint1/main1.c:1.22 src/usr.bin/xlint/lint1/main1.c:1.23
--- src/usr.bin/xlint/lint1/main1.c:1.22	Thu Apr 17 21:15:07 2014
+++ src/usr.bin/xlint/lint1/main1.c	Thu Apr 17 21:18:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main1.c,v 1.22 2014/04/18 01:15:07 christos Exp $	*/
+/*	$NetBSD: main1.c,v 1.23 2014/04/18 01:18:54 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.22 2014/04/18 01:15:07 christos Exp $");
+__RCSID("$NetBSD: main1.c,v 1.23 2014/04/18 01:18:54 christos Exp $");
 #endif
 
 #include 
@@ -128,11 +128,13 @@ sig_atomic_t fpe;
 
 static	void	usage(void);
 
+#ifdef __NetBSD__
 static const char builtins[] =
 "int __builtin_isinf(long double);\n"
 "int __builtin_isnan(long double);\n"
 "int __builtin_copysign(long double, long double);\n"
 ;
+#endif
 
 /*ARGSUSED*/
 static void
@@ -220,10 +222,12 @@ main(int argc, char *argv[])
 	initscan();
 	initmtab();
 
+#ifdef __NetBSD__
 	if ((yyin = fmemopen(__UNCONST(builtins), sizeof(builtins) - 1, "r"))
 	== NULL)
 		err(1, "cannot open builtins");
 	yyparse();
+#endif
 	/* open the input file */
 	if ((yyin = fopen(argv[0], "r")) == NULL)
 		err(1, "cannot open '%s'", argv[0]);



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 01:15:07 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: main1.c

Log Message:
Add some builtins


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint1/main1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/main1.c
diff -u src/usr.bin/xlint/lint1/main1.c:1.21 src/usr.bin/xlint/lint1/main1.c:1.22
--- src/usr.bin/xlint/lint1/main1.c:1.21	Fri Apr 19 13:43:05 2013
+++ src/usr.bin/xlint/lint1/main1.c	Thu Apr 17 21:15:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main1.c,v 1.21 2013/04/19 17:43:05 christos Exp $	*/
+/*	$NetBSD: main1.c,v 1.22 2014/04/18 01:15:07 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.21 2013/04/19 17:43:05 christos Exp $");
+__RCSID("$NetBSD: main1.c,v 1.22 2014/04/18 01:15:07 christos Exp $");
 #endif
 
 #include 
@@ -128,7 +128,11 @@ sig_atomic_t fpe;
 
 static	void	usage(void);
 
-int main(int, char *[]);
+static const char builtins[] =
+"int __builtin_isinf(long double);\n"
+"int __builtin_isnan(long double);\n"
+"int __builtin_copysign(long double, long double);\n"
+;
 
 /*ARGSUSED*/
 static void
@@ -203,9 +207,6 @@ main(int argc, char *argv[])
 	if (argc != 2)
 		usage();
 
-	/* open the input file */
-	if ((yyin = fopen(argv[0], "r")) == NULL)
-		err(1, "cannot open '%s'", argv[0]);
 
 	/* initialize output */
 	outopen(argv[1]);
@@ -219,6 +220,13 @@ main(int argc, char *argv[])
 	initscan();
 	initmtab();
 
+	if ((yyin = fmemopen(__UNCONST(builtins), sizeof(builtins) - 1, "r"))
+	== NULL)
+		err(1, "cannot open builtins");
+	yyparse();
+	/* open the input file */
+	if ((yyin = fopen(argv[0], "r")) == NULL)
+		err(1, "cannot open '%s'", argv[0]);
 	yyparse();
 
 	/* Following warnings cannot be suppressed by LINTED */



CVS commit: src/share/mk

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 00:37:46 UTC 2014

Modified Files:
src/share/mk: bsd.README sys.mk

Log Message:
Add -g (gnu) so lint recognizes __attribute__


To generate a diff of this commit:
cvs rdiff -u -r1.329 -r1.330 src/share/mk/bsd.README
cvs rdiff -u -r1.123 -r1.124 src/share/mk/sys.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.329 src/share/mk/bsd.README:1.330
--- src/share/mk/bsd.README:1.329	Tue Mar 25 05:52:55 2014
+++ src/share/mk/bsd.README	Thu Apr 17 20:37:46 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.329 2014/03/25 09:52:55 ozaki-r Exp $
+#	$NetBSD: bsd.README,v 1.330 2014/04/18 00:37:46 christos Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -1889,7 +1889,7 @@ LDFLAGS		Options to ${CC} during the lin
 
 LINT		C program verifier.  [lint]
 
-LINTFLAGS	Options to ${LINT}.  [-chapbxzFS]
+LINTFLAGS	Options to ${LINT}.  [-chapbxzgFS]
 
 LORDER		List dependencies for object files.  [lorder]
 

Index: src/share/mk/sys.mk
diff -u src/share/mk/sys.mk:1.123 src/share/mk/sys.mk:1.124
--- src/share/mk/sys.mk:1.123	Thu Apr  3 14:27:37 2014
+++ src/share/mk/sys.mk	Thu Apr 17 20:37:46 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: sys.mk,v 1.123 2014/04/03 18:27:37 riastradh Exp $
+#	$NetBSD: sys.mk,v 1.124 2014/04/18 00:37:46 christos Exp $
 #	@(#)sys.mk	8.2 (Berkeley) 3/21/94
 #
 # This file contains the basic rules for make(1) and is read first
@@ -91,7 +91,7 @@ LFLAGS?=
 LEX.l?=		${LEX} ${LFLAGS}
 
 LINT?=		lint
-LINTFLAGS?=	-chapbxzFS
+LINTFLAGS?=	-chapbxzgFS
 
 LORDER?=	lorder
 



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 00:23:46 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: cgram.y externs1.h scan.l

Log Message:
Handle the rest of gcc __attribute__ s.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.54 -r1.55 src/usr.bin/xlint/lint1/scan.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.60 src/usr.bin/xlint/lint1/cgram.y:1.61
--- src/usr.bin/xlint/lint1/cgram.y:1.60	Thu Apr 17 13:29:24 2014
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Apr 17 20:23:46 2014
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.60 2014/04/17 17:29:24 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.61 2014/04/18 00:23:46 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.60 2014/04/17 17:29:24 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.61 2014/04/18 00:23:46 christos Exp $");
 #endif
 
 #include 
@@ -189,11 +189,17 @@ static inline void RESTORE(const char *f
 %token 		T_ATTRIBUTE
 %token 		T_AT_ALIGNED
 %token 		T_AT_DEPRECATED
+%token 		T_AT_NORETURN
 %token 		T_AT_MAY_ALIAS
 %token 		T_AT_PACKED
+%token 		T_AT_PURE
 %token 		T_AT_TUINION
 %token 		T_AT_TUNION
 %token 		T_AT_UNUSED
+%token 		T_AT_FORMAT
+%token 		T_AT_FORMAT_PRINTF
+%token 		T_AT_FORMAT_SCANF
+%token 		T_AT_FORMAT_STRFTIME
 
 
 
@@ -470,19 +476,33 @@ declaration:
 	| error T_SEMI
 	;
 
+type_attribute_format_type:
+	  T_AT_FORMAT_PRINTF
+	| T_AT_FORMAT_SCANF
+	| T_AT_FORMAT_STRFTIME
+	;
+
 type_attribute_spec:
 	  T_AT_DEPRECATED
 	| T_AT_ALIGNED T_LPARN constant T_RPARN
 	| T_AT_MAY_ALIAS
+	| T_AT_NORETURN
 	| T_AT_PACKED {
 		addpacked();
 	}
+	| T_AT_PURE
 	| T_AT_TUNION
+	| T_AT_FORMAT T_LPARN type_attribute_format_type T_COMMA
+	constant T_COMMA constant T_RPARN
 	| T_AT_UNUSED
 	;
 
 type_attribute:
-	  T_ATTRIBUTE T_LPARN T_LPARN type_attribute_spec T_RPARN T_RPARN
+	  T_ATTRIBUTE T_LPARN T_LPARN {
+	attron = 1;
+	} type_attribute_spec {
+	attron = 0;
+	} T_RPARN T_RPARN
 	| T_PACKED {
 		addpacked();
 	}

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.31 src/usr.bin/xlint/lint1/externs1.h:1.32
--- src/usr.bin/xlint/lint1/externs1.h:1.31	Fri Apr 19 13:43:05 2013
+++ src/usr.bin/xlint/lint1/externs1.h	Thu Apr 17 20:23:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.31 2013/04/19 17:43:05 christos Exp $	*/
+/*	$NetBSD: externs1.h,v 1.32 2014/04/18 00:23:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -68,6 +68,7 @@ extern	int	yyparse(void);
 /*
  * scan.l
  */
+extern  int	attron;
 extern	pos_t	curr_pos;
 extern	pos_t	csrc_pos;
 extern	symt_t	symtyp;

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.54 src/usr.bin/xlint/lint1/scan.l:1.55
--- src/usr.bin/xlint/lint1/scan.l:1.54	Tue Feb 18 17:01:36 2014
+++ src/usr.bin/xlint/lint1/scan.l	Thu Apr 17 20:23:46 2014
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.54 2014/02/18 22:01:36 christos Exp $ */
+/* $NetBSD: scan.l,v 1.55 2014/04/18 00:23:46 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.54 2014/02/18 22:01:36 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.55 2014/04/18 00:23:46 christos Exp $");
 #endif
 
 #include 
@@ -60,6 +60,9 @@ pos_t	curr_pos = { 1, "", 0 };
  */
 pos_t	csrc_pos = { 1, "", 0 };
 
+/* Are we parsing a gcc attribute? */
+int attron;
+
 static	void	incline(void);
 static	void	badchar(int);
 static	sbuf_t	*allocsb(void);
@@ -193,81 +196,95 @@ static	struct	kwtab {
 	scl_t	kw_scl;		/* storage class if kw_token T_SCLASS */
 	tspec_t	kw_tspec;	/* type spec. if kw_token T_TYPE or T_SOU */
 	tqual_t	kw_tqual;	/* type qual. fi kw_token T_QUAL */
-	u_int	kw_c89;		/* c89 keyword */
-	u_int	kw_c99;		/* c99 keyword */
-	u_int	kw_gcc;		/* GCC keyword */
+	u_int	kw_c89 : 1;	/* c89 keyword */
+	u_int	kw_c99 : 1;	/* c99 keyword */
+	u_int	kw_gcc : 1;	/* GCC keyword */
+	u_int	kw_attr : 1;	/* GCC attribute, keyword */
 } kwtab[] = {
-	{ "__alignof__", T_ALIGNOF,	0,	0,	0,	  0, 0, 0 },
-	{ "__attribute__",T_ATTRIBUTE,	0,	0,	0,	  0, 0, 1 },
-	{ "attribute",	T_ATTRIBUTE,	0,	0,	0,	  0, 0, 1 },
-	{ "__packed__",	T_AT_PACKED,	0,	0,	0,	  0, 0, 1 },
-	{ "packed",	T_AT_PACKED,	0,	0,	0,	  0, 0, 1 },
-	{ "__aligned__",T_AT_ALIGNED,	0,	0,	0,	  0, 0, 1 },
-	{ "aligned",	T_AT_ALIGNED,	0,	0,	0,	  0, 0, 1 },
-	{ "__transparent_union__",T_AT_TUNION,0,0,	0,	  0, 0, 1 },
-	{ "transparent_union",T_AT_TUNION,0,	0,	0,	  0, 0, 1 },
-	{ "__unused__",	T_AT_UNUSED,	0,	0,	0,	  0, 0, 1 },
-	{ 

CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 00:21:14 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: lint1.h mem1.c

Log Message:
only fill memory with junk if BLKDEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/lint1/mem1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.27 src/usr.bin/xlint/lint1/lint1.h:1.28
--- src/usr.bin/xlint/lint1/lint1.h:1.27	Fri Apr 19 13:43:05 2013
+++ src/usr.bin/xlint/lint1/lint1.h	Thu Apr 17 20:21:14 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.27 2013/04/19 17:43:05 christos Exp $ */
+/* $NetBSD: lint1.h,v 1.28 2014/04/18 00:21:14 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -226,7 +226,7 @@ typedef	struct sym {
 	pos_t	s_spos;		/* position of first initialisation */
 	pos_t	s_upos;		/* position of first use */
 	symt_t	s_kind;		/* type of symbol */
-	u_int	s_keyw : 1;	/* keyword */
+	void   *s_keyw;		/* keyword */
 	u_int	s_field : 1;	/* bit-field */
 	u_int	s_set : 1;	/* variable set, label defined */
 	u_int	s_used : 1;	/* variable/label used */
@@ -436,4 +436,10 @@ typedef	struct err_set {
 
 #define LERROR(fmt, args...)	lerror(__FILE__, __LINE__, fmt, ##args)
 
+#ifdef BLKDEBUG
+#define ZERO	0xa5
+#else
+#define	ZERO	0
+#endif
+
 extern err_set	msgset;

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.16 src/usr.bin/xlint/lint1/mem1.c:1.17
--- src/usr.bin/xlint/lint1/mem1.c:1.16	Thu Apr 17 12:30:05 2014
+++ src/usr.bin/xlint/lint1/mem1.c	Thu Apr 17 20:21:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.16 2014/04/17 16:30:05 christos Exp $	*/
+/*	$NetBSD: mem1.c,v 1.17 2014/04/18 00:21:14 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.16 2014/04/17 16:30:05 christos Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.17 2014/04/18 00:21:14 christos Exp $");
 #endif
 
 #include 
@@ -200,9 +200,11 @@ xgetblk(mbl_t **mbp, size_t s)
 mblklen = s;
 			}
 			mb = xnewblk();
+#ifndef BLKDEBUG
+			(void)memset(mb->blk, 0, mb->size);
+#endif
 			if (t)
 mblklen = t;
-			(void)memset(mb->blk, 0, mb->size);
 		} else {
 			frmblks = mb->nxt;
 		}
@@ -214,6 +216,9 @@ xgetblk(mbl_t **mbp, size_t s)
 	p = mb->ffree;
 	mb->ffree = (char *)mb->ffree + s;
 	mb->nfree -= s;
+#ifdef BLKDEBUG
+	(void)memset(p, 0, s);
+#endif
 	return (p);
 }
 
@@ -230,7 +235,7 @@ xfreeblk(mbl_t **fmbp)
 		*fmbp = mb->nxt;
 		mb->nxt = frmblks;
 		frmblks = mb;
-		(void)memset(mb->blk, 0xa5, mb->size - mb->nfree);
+		(void)memset(mb->blk, ZERO, mb->size - mb->nfree);
 	}
 }
 



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 18 00:20:37 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
handle LDOUBLE


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/decl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.58 src/usr.bin/xlint/lint1/decl.c:1.59
--- src/usr.bin/xlint/lint1/decl.c:1.58	Sat Dec 14 22:43:37 2013
+++ src/usr.bin/xlint/lint1/decl.c	Thu Apr 17 20:20:37 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.58 2013/12/15 03:43:37 christos Exp $ */
+/* $NetBSD: decl.c,v 1.59 2014/04/18 00:20:37 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.58 2013/12/15 03:43:37 christos Exp $");
+__RCSID("$NetBSD: decl.c,v 1.59 2014/04/18 00:20:37 christos Exp $");
 #endif
 
 #include 
@@ -757,6 +757,7 @@ deftyp(void)
 			break;
 		case DOUBLE:
 			if (l == LONG) {
+		case LDOUBLE:
 l = NOTSPEC;
 t = LDOUBLE;
 if (tflag)
@@ -778,7 +779,7 @@ deftyp(void)
 		case LCOMPLEX:
 			break;
 		default:
-			LERROR("deftyp()");
+			LERROR("deftyp(%s)", basictyname(t));
 		}
 		if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
 			dcs->d_terr = 1;



CVS commit: src/distrib/sets/lists/tests

2014-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Apr 17 23:15:27 UTC 2014

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
Reference the correct test file name...

Hello again, xtos!


To generate a diff of this commit:
cvs rdiff -u -r1.565 -r1.566 src/distrib/sets/lists/tests/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.565 src/distrib/sets/lists/tests/mi:1.566
--- src/distrib/sets/lists/tests/mi:1.565	Thu Apr 17 18:37:07 2014
+++ src/distrib/sets/lists/tests/mi	Thu Apr 17 23:15:27 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.565 2014/04/17 18:37:07 christos Exp $
+# $NetBSD: mi,v 1.566 2014/04/17 23:15:27 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3159,7 +3159,7 @@
 ./usr/tests/usr.bin/xlint/lint1/d_constant_conv1.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_constant_conv2.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_cvt_in_ternary.c		tests-usr.bin-tests	atf
-./usr/tests/usr.bin/xlint/lint1/d_cvt_in_constant.c		tests-usr.bin-tests	atf
+./usr/tests/usr.bin/xlint/lint1/d_cvt_constant.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_ellipsis_in_switch.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c	tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c	tests-usr.bin-tests	atf



CVS commit: src/usr.bin/xlint/common

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 18:52:03 UTC 2014

Modified Files:
src/usr.bin/xlint/common: emit.c externs.h

Log Message:
make outname print where it came from in case of error


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/common/emit.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/xlint/common/externs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/emit.c
diff -u src/usr.bin/xlint/common/emit.c:1.5 src/usr.bin/xlint/common/emit.c:1.6
--- src/usr.bin/xlint/common/emit.c:1.5	Tue Apr 14 21:20:57 2009
+++ src/usr.bin/xlint/common/emit.c	Thu Apr 17 14:52:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $	*/
+/*	$NetBSD: emit.c,v 1.6 2014/04/17 18:52:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit.c,v 1.5 2009/04/15 01:20:57 christos Exp $");
+__RCSID("$NetBSD: emit.c,v 1.6 2014/04/17 18:52:03 christos Exp $");
 #endif
 
 #include 
@@ -216,11 +216,11 @@ outint(int i)
  * the name is preceded by its length
  */
 void
-outname(const char *name)
+outname1(const char *file, size_t line, const char *name)
 {
 
 	if (name == NULL)
-		errx(1, "internal error: outname() 1");
+		errx(1, "%s, %zu: internal error: outname(NULL)", file, line);
 	outint((int)strlen(name));
 	outstrg(name);
 }

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.4 src/usr.bin/xlint/common/externs.h:1.5
--- src/usr.bin/xlint/common/externs.h:1.4	Thu Apr  7 12:28:40 2005
+++ src/usr.bin/xlint/common/externs.h	Thu Apr 17 14:52:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.4 2005/04/07 16:28:40 christos Exp $	*/
+/*	$NetBSD: externs.h,v 1.5 2014/04/17 18:52:03 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -69,5 +69,6 @@ extern	void	outchar(int);
 extern	void	outqchar(int);
 extern	void	outstrg(const char *);
 extern	void	outint(int);
-extern	void	outname(const char *);
+#define outname(a)	outname1(__FILE__, __LINE__, a);
+extern	void	outname1(const char *, size_t, const char *);
 extern	void	outsrc(const char *);



CVS commit: src/distrib/sets/lists/tests

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 18:37:07 UTC 2014

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
add new lint tests


To generate a diff of this commit:
cvs rdiff -u -r1.564 -r1.565 src/distrib/sets/lists/tests/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.564 src/distrib/sets/lists/tests/mi:1.565
--- src/distrib/sets/lists/tests/mi:1.564	Sun Apr  6 15:51:40 2014
+++ src/distrib/sets/lists/tests/mi	Thu Apr 17 14:37:07 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.564 2014/04/06 19:51:40 christos Exp $
+# $NetBSD: mi,v 1.565 2014/04/17 18:37:07 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3138,6 +3138,7 @@
 ./usr/tests/usr.bin/xlint/lint1/Kyuafile	tests-usr.bin-tests	atf,kyua
 ./usr/tests/usr.bin/xlint/lint1/d_alignof.c			tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_complex_num.c		tests-usr.bin-tests	atf
+./usr/tests/usr.bin/xlint/lint1/d_c99_complex_split.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c	tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt2.c	tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c	tests-usr.bin-tests	atf
@@ -3158,10 +3159,12 @@
 ./usr/tests/usr.bin/xlint/lint1/d_constant_conv1.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_constant_conv2.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_cvt_in_ternary.c		tests-usr.bin-tests	atf
+./usr/tests/usr.bin/xlint/lint1/d_cvt_in_constant.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_ellipsis_in_switch.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c	tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c	tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements3.c	tests-usr.bin-tests	atf
+./usr/tests/usr.bin/xlint/lint1/d_gcc_extension.c		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_func.c			tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_variable_array_init.c	tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/xlint/lint1/d_incorrect_array_size.c	tests-usr.bin-tests	atf



CVS commit: src/tests/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 18:34:44 UTC 2014

Modified Files:
src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh
Added Files:
src/tests/usr.bin/xlint/lint1: d_c99_complex_split.c d_cvt_constant.c
d_gcc_extension.c

Log Message:
add more tests


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/Makefile \
src/tests/usr.bin/xlint/lint1/t_integration.sh
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_c99_complex_split.c \
src/tests/usr.bin/xlint/lint1/d_cvt_constant.c \
src/tests/usr.bin/xlint/lint1/d_gcc_extension.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.2 src/tests/usr.bin/xlint/lint1/Makefile:1.3
--- src/tests/usr.bin/xlint/lint1/Makefile:1.2	Tue Feb  4 03:08:59 2014
+++ src/tests/usr.bin/xlint/lint1/Makefile	Thu Apr 17 14:34:44 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2014/02/04 08:08:59 njoly Exp $
+# $NetBSD: Makefile,v 1.3 2014/04/17 18:34:44 christos Exp $
 
 NOMAN=		# defined
 
@@ -11,6 +11,7 @@ TESTS_SH=	t_integration
 FILESDIR=	${TESTSDIR}
 FILES+=		d_alignof.c
 FILES+=		d_c99_complex_num.c
+FILES+=		d_c99_complex_split.c
 FILES+=		d_c99_decls_after_stmt.c
 FILES+=		d_c99_decls_after_stmt2.c
 FILES+=		d_c99_decls_after_stmt3.c
@@ -31,10 +32,12 @@ FILES+=		d_compound_literals2.c
 FILES+=		d_constant_conv1.c
 FILES+=		d_constant_conv2.c
 FILES+=		d_cvt_in_ternary.c
+FILES+=		d_cvt_constant.c
 FILES+=		d_ellipsis_in_switch.c
 FILES+=		d_gcc_compound_statements1.c
 FILES+=		d_gcc_compound_statements2.c
 FILES+=		d_gcc_compound_statements3.c
+FILES+=		d_gcc_extension.c
 FILES+=		d_gcc_func.c
 FILES+=		d_gcc_variable_array_init.c
 FILES+=		d_incorrect_array_size.c
Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.2 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.3
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.2	Tue Feb  4 03:08:59 2014
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Thu Apr 17 14:34:44 2014
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.2 2014/02/04 08:08:59 njoly Exp $
+# $NetBSD: t_integration.sh,v 1.3 2014/04/17 18:34:44 christos Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -93,11 +93,13 @@ test_case check_valid gcc_compound_state
 "statements with non-expressions"
 test_case check_valid gcc_compound_statements3 "Checks GCC compound" \
 "statements with void type"
+test_case check_valid gcc_extension "Checks GCC __extension__ and __typeof__"
 
 test_case check_valid cvt_in_ternary "Checks CVT nodes handling in ?" \
-"operator"
+test_case check_valid cvt_constant "Checks constant conversion"
 test_case check_valid ellipsis_in_switch "Checks ellipsis in switch()"
 test_case check_valid c99_complex_num "Checks C99 complex numbers"
+test_case check_valid c99_complex_split "Checks C99 complex access"
 test_case check_valid c99_for_loops "Checks C99 for loops"
 test_case check_valid alignof "Checks __alignof__"
 test_case check_valid shift_to_narrower_type "Checks that type shifts that" \

Added files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_complex_split.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_c99_complex_split.c:1.1
--- /dev/null	Thu Apr 17 14:34:44 2014
+++ src/tests/usr.bin/xlint/lint1/d_c99_complex_split.c	Thu Apr 17 14:34:44 2014
@@ -0,0 +1,5 @@
+void a(void) {
+double _Complex z = 0;
+if (__builtin_isnan((__real__ z)) && __builtin_isnan((__imag__ z)))
+	return;
+}
Index: src/tests/usr.bin/xlint/lint1/d_cvt_constant.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_cvt_constant.c:1.1
--- /dev/null	Thu Apr 17 14:34:44 2014
+++ src/tests/usr.bin/xlint/lint1/d_cvt_constant.c	Thu Apr 17 14:34:44 2014
@@ -0,0 +1,8 @@
+/* the second assignment assumes failed before */
+int
+main(void) {
+double x = 1;
+int foo = 0;
+if (foo)
+	x = 1;
+}
Index: src/tests/usr.bin/xlint/lint1/d_gcc_extension.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_gcc_extension.c:1.1
--- /dev/null	Thu Apr 17 14:34:44 2014
+++ src/tests/usr.bin/xlint/lint1/d_gcc_extension.c	Thu Apr 17 14:34:44 2014
@@ -0,0 +1,6 @@
+/* extension */
+void a(void) {
+double __logbw = 1;
+if (__extension__(({ __typeof((__logbw)) x_ = (__logbw); !__builtin_isinf((x_)) && !__builtin_isnan((x_)); })))
+	__logbw = 1;
+}



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 18:23:18 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
- add a function to dump a node
- better diagnostics on abort
- allow converting a constant
- initialize right node now that we trash memory this makes a difference.
  before it was NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.75 src/usr.bin/xlint/lint1/tree.c:1.76
--- src/usr.bin/xlint/lint1/tree.c:1.75	Tue Feb 18 17:01:36 2014
+++ src/usr.bin/xlint/lint1/tree.c	Thu Apr 17 14:23:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.75 2014/02/18 22:01:36 christos Exp $	*/
+/*	$NetBSD: tree.c,v 1.76 2014/04/17 18:23:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.75 2014/02/18 22:01:36 christos Exp $");
+__RCSID("$NetBSD: tree.c,v 1.76 2014/04/17 18:23:18 christos Exp $");
 #endif
 
 #include 
@@ -89,6 +89,45 @@ static	void	precconf(tnode_t *);
 
 extern sig_atomic_t fpe;
 
+#if 0
+static char *
+dumpnode(char *buf, size_t len, tnode_t *tn) {
+	const char *n = getopname(tn->tn_op);
+	const char *s;
+	char tbuf[256];
+
+	switch (tn->tn_op) {
+	case NAME:
+		s = tn->tn_sym->s_name;
+		break;
+	case CON:
+	case STRING:
+		s = "*";	/* todo */
+		break;
+	default:
+		s = NULL;
+		break;
+	}
+	char lb[1024];
+	char rb[1024];
+
+	if (s == NULL && tn->tn_left != NULL)
+		dumpnode(lb, sizeof(lb), tn->tn_left);
+	else
+		strcpy(lb, "(null)");
+
+	if (s == NULL && tn->tn_right != NULL)
+		dumpnode(rb, sizeof(rb), tn->tn_right);
+	else
+		strcpy(rb, "(null)");
+
+
+	snprintf(buf, len, "%s: (%s) = %s [%s, %s]", n,
+	tyname(tbuf, sizeof(tbuf), tn->tn_type), s, lb, rb);
+	return buf;
+}
+#endif
+
 /*
  * Increase degree of reference.
  * This is most often used to change type "T" in type "pointer to T".
@@ -204,7 +243,7 @@ getnnode(sym_t *sym, int ntok)
 	}
 
 	if (sym->s_kind != FVFT && sym->s_kind != FMOS)
-		LERROR("getnnode()");
+		LERROR("getnnode(%d)", sym->s_kind);
 
 	n = getnode();
 	n->tn_type = sym->s_type;
@@ -1616,9 +1655,6 @@ convert(op_t op, int arg, type_t *tp, tn
 	tnode_t	*ntn;
 	tspec_t	nt, ot, ost = NOTSPEC;
 
-	if (tn->tn_lvalue)
-		LERROR("convert()");
-
 	nt = tp->t_tspec;
 	if ((ot = tn->tn_type->t_tspec) == PTR)
 		ost = tn->tn_type->t_subt->t_tspec;
@@ -1640,6 +1676,7 @@ convert(op_t op, int arg, type_t *tp, tn
 	ntn->tn_op = CVT;
 	ntn->tn_type = tp;
 	ntn->tn_cast = op == CVT;
+	ntn->tn_right = NULL;
 	if (tn->tn_op != CON || nt == VOID) {
 		ntn->tn_left = tn;
 	} else {
@@ -3569,7 +3606,9 @@ chkmisc(tnode_t *tn, int vctx, int tctx,
 		break;
 	case CALL:
 		if (ln->tn_op != AMPER || ln->tn_left->tn_op != NAME)
-			LERROR("chkmisc()");
+			LERROR("chkmisc(op=%s != %s || %s != %s)",
+			getopname(ln->tn_op), getopname(AMPER),
+			getopname(ln->tn_left->tn_op), getopname(NAME));
 		if (!szof)
 			outcall(tn, vctx || tctx, rvdisc);
 		break;



CVS commit: src/sys/dev/ic

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 18:17:09 UTC 2014

Modified Files:
src/sys/dev/ic: aic79xx.c

Log Message:
put back missing arg


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/aic79xx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/aic79xx.c
diff -u src/sys/dev/ic/aic79xx.c:1.48 src/sys/dev/ic/aic79xx.c:1.49
--- src/sys/dev/ic/aic79xx.c:1.48	Thu Apr 17 12:04:47 2014
+++ src/sys/dev/ic/aic79xx.c	Thu Apr 17 14:17:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic79xx.c,v 1.48 2014/04/17 16:04:47 christos Exp $	*/
+/*	$NetBSD: aic79xx.c,v 1.49 2014/04/17 18:17:09 christos Exp $	*/
 
 /*
  * Core routines and tables shareable across OS platforms.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.48 2014/04/17 16:04:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.49 2014/04/17 18:17:09 christos Exp $");
 
 #include 
 #include 
@@ -8609,7 +8609,7 @@ ahd_print_register(ahd_reg_parse_entry_t
 	if (table == NULL) {
 		if (printed < sizeof(line))
 		printed += snprintf(&line[printed],
-			(sizeof line) - printed,
+			(sizeof line) - printed, " ");
 		printf("%s", line);
 		if (cur_column != NULL)
 			*cur_column += printed;



CVS commit: src/sys/ufs/lfs

2014-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Apr 17 18:15:49 UTC 2014

Modified Files:
src/sys/ufs/lfs: lfs_syscalls.c

Log Message:
s/null/NULL/ to fix build break

Hello, xtos!


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/ufs/lfs/lfs_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/lfs_syscalls.c
diff -u src/sys/ufs/lfs/lfs_syscalls.c:1.154 src/sys/ufs/lfs/lfs_syscalls.c:1.155
--- src/sys/ufs/lfs/lfs_syscalls.c:1.154	Thu Apr 17 15:57:41 2014
+++ src/sys/ufs/lfs/lfs_syscalls.c	Thu Apr 17 18:15:49 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_syscalls.c,v 1.154 2014/04/17 15:57:41 christos Exp $	*/
+/*	$NetBSD: lfs_syscalls.c,v 1.155 2014/04/17 18:15:49 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.154 2014/04/17 15:57:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.155 2014/04/17 18:15:49 pgoyette Exp $");
 
 #ifndef LFS
 # define LFS		/* for prototypes in syscallargs.h */
@@ -754,7 +754,7 @@ lfs_bmapv(struct proc *p, fsid_t *fsidp,
 }
 numrefed++;
 			} else {
-if (vp != null)
+if (vp != NULL)
 	mutex_exit(vp->v_interlock);
 mutex_exit(&ulfs_ihash_lock);
 /*



CVS commit: src/share/man/man4

2014-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 17 17:50:21 UTC 2014

Modified Files:
src/share/man/man4: ucom.4

Log Message:
Add missing uark and umcs attachments, bump date


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/share/man/man4/ucom.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/ucom.4
diff -u src/share/man/man4/ucom.4:1.22 src/share/man/man4/ucom.4:1.23
--- src/share/man/man4/ucom.4:1.22	Sun Oct 13 09:48:14 2013
+++ src/share/man/man4/ucom.4	Thu Apr 17 17:50:21 2014
@@ -1,4 +1,4 @@
-.\" $NetBSD: ucom.4,v 1.22 2013/10/13 09:48:14 mbalmer Exp $
+.\" $NetBSD: ucom.4,v 1.23 2014/04/17 17:50:21 martin Exp $
 .\"
 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 13, 2013
+.Dd April 17, 2014
 .Dt UCOM 4
 .Os
 .Sh NAME
@@ -35,6 +35,7 @@
 .Nd USB tty support
 .Sh SYNOPSIS
 .Cd "ucom* at u3g?"
+.Cd "ucom* at uark?"
 .Cd "ucom* at ubsa?"
 .Cd "ucom* at uchcom?"
 .Cd "ucom* at uftdi?"
@@ -42,6 +43,7 @@
 .Cd "ucom* at uhmodem?"
 .Cd "ucom* at uipaq?"
 .Cd "ucom* at ukyopon?"
+.Cd "ucom* at umcs? portno ?"
 .Cd "ucom* at umct?"
 .Cd "ucom* at umodem?"
 .Cd "ucom* at uplcom?"



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 17:29:24 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
typeof and extension don't need parens


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.bin/xlint/lint1/cgram.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.59 src/usr.bin/xlint/lint1/cgram.y:1.60
--- src/usr.bin/xlint/lint1/cgram.y:1.59	Sun Mar 23 00:58:16 2014
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Apr 17 13:29:24 2014
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.59 2014/03/23 04:58:16 dholland Exp $ */
+/* $NetBSD: cgram.y,v 1.60 2014/04/17 17:29:24 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.59 2014/03/23 04:58:16 dholland Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.60 2014/04/17 17:29:24 christos Exp $");
 #endif
 
 #include 
@@ -107,7 +107,7 @@ static inline void RESTORE(const char *f
 #endif
 %}
 
-%expect 5
+%expect 12
 
 %union {
 	int	y_int;
@@ -555,8 +555,8 @@ notype_typespec:
 	  T_TYPE {
 		$$ = gettyp($1);
 	  }
-	| T_TYPEOF T_LPARN term T_RPARN {
-		$$ = $3->tn_type;
+	| T_TYPEOF term {
+		$$ = $2->tn_type;
 	  }
 	| struct_spec {
 		popdecl();
@@ -1731,15 +1731,15 @@ term:
 	| T_IMAG term {
 		$$ = build(IMAG, $2, NULL);
 	  }
+	| T_EXTENSION term {
+		$$ = $2;
+	  }
 	| T_REAL T_LPARN term T_RPARN {
 		$$ = build(REAL, $3, NULL);
 	  }
 	| T_IMAG T_LPARN term T_RPARN {
 		$$ = build(IMAG, $3, NULL);
 	  }
-	| T_EXTENSION T_LPARN term T_RPARN {
-		$$ = $3;
-	  }
 	| T_SIZEOF term	%prec T_SIZEOF {
 		if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL)
 			chkmisc($2, 0, 0, 0, 0, 0, 1);



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 16:30:06 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: mem1.c

Log Message:
Trash freed memory so we catch bad uses.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/lint1/mem1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.15 src/usr.bin/xlint/lint1/mem1.c:1.16
--- src/usr.bin/xlint/lint1/mem1.c:1.15	Thu Jun 23 21:10:31 2011
+++ src/usr.bin/xlint/lint1/mem1.c	Thu Apr 17 12:30:05 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.15 2011/06/24 01:10:31 christos Exp $	*/
+/*	$NetBSD: mem1.c,v 1.16 2014/04/17 16:30:05 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.15 2011/06/24 01:10:31 christos Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.16 2014/04/17 16:30:05 christos Exp $");
 #endif
 
 #include 
@@ -230,7 +230,7 @@ xfreeblk(mbl_t **fmbp)
 		*fmbp = mb->nxt;
 		mb->nxt = frmblks;
 		frmblks = mb;
-		(void)memset(mb->blk, 0, mb->size - mb->nfree);
+		(void)memset(mb->blk, 0xa5, mb->size - mb->nfree);
 	}
 }
 



CVS commit: src/usr.bin/xlint/lint1

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 16:29:26 UTC 2014

Modified Files:
src/usr.bin/xlint/lint1: init.c

Log Message:
Don't free memory; it is used later.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/lint1/init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.24 src/usr.bin/xlint/lint1/init.c:1.25
--- src/usr.bin/xlint/lint1/init.c:1.24	Fri Oct  2 14:17:16 2009
+++ src/usr.bin/xlint/lint1/init.c	Thu Apr 17 12:29:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.24 2009/10/02 18:17:16 christos Exp $	*/
+/*	$NetBSD: init.c,v 1.25 2014/04/17 16:29:26 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.24 2009/10/02 18:17:16 christos Exp $");
+__RCSID("$NetBSD: init.c,v 1.25 2014/04/17 16:29:26 christos Exp $");
 #endif
 
 #include 
@@ -500,7 +500,7 @@ mkinit(tnode_t *tn)
 	DPRINTF(("mkinit(%s %s)\n", tyname(buf, sizeof(buf), tn->tn_type),
 	   prtnode(sbuf, sizeof(sbuf), tn)));
 	if (initerr || tn == NULL)
-		goto end;
+		return;
 
 	sc = initsym->s_scl;
 
@@ -521,8 +521,8 @@ mkinit(tnode_t *tn)
 		ln->tn_type = tduptyp(ln->tn_type);
 		ln->tn_type->t_const = 0;
 		tn = build(ASSIGN, ln, tn);
-		expr(tn, 0, 0, 1);
-		goto end;
+		expr(tn, 0, 0, 0);
+		return;
 	}
 
 	/*
@@ -533,11 +533,11 @@ mkinit(tnode_t *tn)
 
 	/* Initialisations by strings are done in strginit(). */
 	if (strginit(tn))
-		goto end;
+		return;
 
 	nextinit(0);
 	if (initerr || tn == NULL)
-		goto end;
+		return;
 
 	initstk->i_cnt--;
 	DPRINTF(("mkinit() cnt=%d tn=%p\n", initstk->i_cnt, tn));
@@ -558,7 +558,7 @@ mkinit(tnode_t *tn)
 		LERROR("mkinit()");
 
 	if (!typeok(INIT, 0, ln, tn))
-		goto end;
+		return;
 
 	/*
 	 * Store the tree memory. This is nessesary because otherwise
@@ -594,15 +594,6 @@ mkinit(tnode_t *tn)
 			}
 		}
 	}
-
- end:
-	/*
-	 * We only free the block, if we are not a compound declaration
-	 * We know that the only symbols that start with a digit are the
-	 * ones we allocate with mktempsym() for compound declarations
-	 */
-	if (!isdigit((unsigned char)initsym->s_name[0]))
-		tfreeblk();
 }
 
 



CVS commit: src/sys/dev/pci/ixgbe

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 16:22:48 UTC 2014

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_netbsd.h

Log Message:
CID/1008347, CID/1008348, CID/1008349:  overflow before widen
CID/1203198, CID/1203199:  Uninitialized scalar variable


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.12 src/sys/dev/pci/ixgbe/ixgbe.c:1.13
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.12	Tue Apr 15 08:37:59 2014
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Apr 17 12:22:48 2014
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.51 2011/04/25 23:34:21 jfv Exp $*/
-/*$NetBSD: ixgbe.c,v 1.12 2014/04/15 12:37:59 hannken Exp $*/
+/*$NetBSD: ixgbe.c,v 1.13 2014/04/17 16:22:48 christos Exp $*/
 
 #include "opt_inet.h"
 
@@ -1378,7 +1378,7 @@ static inline void
 ixgbe_enable_queue(struct adapter *adapter, u32 vector)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	u64	queue = (u64)(1 << vector);
+	u64	queue = (u64)(1ULL << vector);
 	u32	mask;
 
 	if (hw->mac.type == ixgbe_mac_82598EB) {
@@ -1398,7 +1398,7 @@ __unused static inline void
 ixgbe_disable_queue(struct adapter *adapter, u32 vector)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	u64	queue = (u64)(1 << vector);
+	u64	queue = (u64)(1ULL << vector);
 	u32	mask;
 
 	if (hw->mac.type == ixgbe_mac_82598EB) {
@@ -2725,6 +2725,8 @@ ixgbe_config_link(struct adapter *adapte
 		if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
 	err  = hw->mac.ops.get_link_capabilities(hw,
 			&autoneg, &negotiate);
+		else
+			negotiate = 0;
 		if (err)
 			goto out;
 		if (hw->mac.ops.setup_link)
@@ -4649,7 +4651,7 @@ next_desc:
 	** Schedule another interrupt if so.
 	*/
 	if ((staterr & IXGBE_RXD_STAT_DD) != 0) {
-		ixgbe_rearm_queues(adapter, (u64)(1 << que->msix));
+		ixgbe_rearm_queues(adapter, (u64)(1ULL << que->msix));
 		return true;
 	}
 
@@ -5020,9 +5022,9 @@ ixgbe_handle_link(void *context)
 {
 	struct adapter  *adapter = context;
 
-	ixgbe_check_link(&adapter->hw,
-	&adapter->link_speed, &adapter->link_up, 0);
-   	ixgbe_update_link_status(adapter);
+	if (ixgbe_check_link(&adapter->hw,
+	&adapter->link_speed, &adapter->link_up, 0) == 0)
+	ixgbe_update_link_status(adapter);
 }
 
 /*
@@ -5067,6 +5069,8 @@ ixgbe_handle_msf(void *context)
 	autoneg = hw->phy.autoneg_advertised;
 	if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
 		hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate);
+	else
+		negotiate = 0;
 	if (hw->mac.ops.setup_link)
 		hw->mac.ops.setup_link(hw, autoneg, negotiate, TRUE);
 	return;

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.1 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.2
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.1	Fri Aug 12 17:55:29 2011
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.h	Thu Apr 17 12:22:48 2014
@@ -1,4 +1,4 @@
-/*$NetBSD: ixgbe_netbsd.h,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
+/*$NetBSD: ixgbe_netbsd.h,v 1.2 2014/04/17 16:22:48 christos Exp $*/
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,6 @@
 
 #define	ETHERCAP_VLAN_HWFILTER	0
 #define	ETHERCAP_VLAN_HWCSUM	0
-#define	IFCAP_LRO		0
 #define	MJUM9BYTES	(9 * 1024)
 #define	MJUM16BYTES	(16 * 1024)
 #define	MJUMPAGESIZE	PAGE_SIZE



CVS commit: src/sys

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 16:14:22 UTC 2014

Modified Files:
src/sys/kern: uipc_domain.c
src/sys/sys: socket.h

Log Message:
CID/1203196: Don't confuse coverity with out of bounds access


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/kern/uipc_domain.c
cvs rdiff -u -r1.108 -r1.109 src/sys/sys/socket.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/uipc_domain.c
diff -u src/sys/kern/uipc_domain.c:1.91 src/sys/kern/uipc_domain.c:1.92
--- src/sys/kern/uipc_domain.c:1.91	Wed Apr  2 11:35:45 2014
+++ src/sys/kern/uipc_domain.c	Thu Apr 17 12:14:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_domain.c,v 1.91 2014/04/02 15:35:45 seanb Exp $	*/
+/*	$NetBSD: uipc_domain.c,v 1.92 2014/04/17 16:14:22 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.91 2014/04/02 15:35:45 seanb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.92 2014/04/17 16:14:22 christos Exp $");
 
 #include 
 #include 
@@ -418,7 +418,7 @@ sysctl_dounpcb(struct kinfo_pcb *pcb, co
 	pcb->ki_rcvq = so->so_rcv.sb_cc;
 	pcb->ki_sndq = so->so_snd.sb_cc;
 
-	un = (struct sockaddr_un *)&pcb->ki_src;
+	un = (struct sockaddr_un *)pcb->ki_spad;
 	/*
 	 * local domain sockets may bind without having a local
 	 * endpoint.  bleah!
@@ -430,17 +430,17 @@ sysctl_dounpcb(struct kinfo_pcb *pcb, co
 		 * makeun().
 		 */
 		memcpy(un, unp->unp_addr,
-		min(sizeof(pcb->ki_s), unp->unp_addr->sun_len + 1));
+		min(sizeof(pcb->ki_spad), unp->unp_addr->sun_len + 1));
 	}
 	else {
 		un->sun_len = offsetof(struct sockaddr_un, sun_path);
 		un->sun_family = pcb->ki_family;
 	}
 	if (unp->unp_conn != NULL) {
-		un = (struct sockaddr_un *)&pcb->ki_dst;
+		un = (struct sockaddr_un *)pcb->ki_dpad;
 		if (unp->unp_conn->unp_addr != NULL) {
 			memcpy(un, unp->unp_conn->unp_addr,
-			min(sizeof(pcb->ki_s), unp->unp_conn->unp_addr->sun_len + 1));
+			min(sizeof(pcb->ki_dpad), unp->unp_conn->unp_addr->sun_len + 1));
 		}
 		else {
 			un->sun_len = offsetof(struct sockaddr_un, sun_path);

Index: src/sys/sys/socket.h
diff -u src/sys/sys/socket.h:1.108 src/sys/sys/socket.h:1.109
--- src/sys/sys/socket.h:1.108	Thu Jan 31 09:30:47 2013
+++ src/sys/sys/socket.h	Thu Apr 17 12:14:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: socket.h,v 1.108 2013/01/31 14:30:47 joerg Exp $	*/
+/*	$NetBSD: socket.h,v 1.109 2014/04/17 16:14:22 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -428,6 +428,8 @@ struct kinfo_pcb {
 
 #define ki_src ki_s._kis_src
 #define ki_dst ki_d._kid_dst
+#define ki_spad ki_s._kis_pad
+#define ki_dpad ki_d._kid_pad
 
 #define PCB_SLOP		20
 #define PCB_ALL			0



CVS commit: src/sys/dev/ic

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 16:08:42 UTC 2014

Modified Files:
src/sys/dev/ic: mpt_netbsd.c

Log Message:
CID/1203197: NULL deref


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/mpt_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mpt_netbsd.c
diff -u src/sys/dev/ic/mpt_netbsd.c:1.23 src/sys/dev/ic/mpt_netbsd.c:1.24
--- src/sys/dev/ic/mpt_netbsd.c:1.23	Thu Apr 17 11:55:53 2014
+++ src/sys/dev/ic/mpt_netbsd.c	Thu Apr 17 12:08:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_netbsd.c,v 1.23 2014/04/17 15:55:53 christos Exp $	*/
+/*	$NetBSD: mpt_netbsd.c,v 1.24 2014/04/17 16:08:42 christos Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.23 2014/04/17 15:55:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.24 2014/04/17 16:08:42 christos Exp $");
 
 #include 			/* pulls in all headers */
 #include 
@@ -516,19 +516,22 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 
 		/* XXX BUS_DMASYNC_POSTREAD XXX */
 		mpt_reply = MPT_REPLY_PTOV(mpt, reply);
-		if (mpt->verbose > 1) {
-			uint32_t *pReply = (uint32_t *) mpt_reply;
+		if (mpt_reply != NULL) {
+			if (mpt->verbose > 1) {
+uint32_t *pReply = (uint32_t *) mpt_reply;
 
-			mpt_prt(mpt, "Address Reply (index %u):",
-			le32toh(mpt_reply->MsgContext) & 0x);
-			mpt_prt(mpt, "%08x %08x %08x %08x",
-			pReply[0], pReply[1], pReply[2], pReply[3]);
-			mpt_prt(mpt, "%08x %08x %08x %08x",
-			pReply[4], pReply[5], pReply[6], pReply[7]);
-			mpt_prt(mpt, "%08x %08x %08x %08x",
-			pReply[8], pReply[9], pReply[10], pReply[11]);
-		}
-		index = le32toh(mpt_reply->MsgContext);
+mpt_prt(mpt, "Address Reply (index %u):",
+le32toh(mpt_reply->MsgContext) & 0x);
+mpt_prt(mpt, "%08x %08x %08x %08x", pReply[0],
+pReply[1], pReply[2], pReply[3]);
+mpt_prt(mpt, "%08x %08x %08x %08x", pReply[4],
+pReply[5], pReply[6], pReply[7]);
+mpt_prt(mpt, "%08x %08x %08x %08x", pReply[8],
+pReply[9], pReply[10], pReply[11]);
+			}
+			index = le32toh(mpt_reply->MsgContext);
+		} else
+			index = reply & MPT_CONTEXT_MASK;
 	}
 
 	/*
@@ -763,16 +766,19 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 		break;
 	}
 
-	if (mpt_reply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {
-		memcpy(&xs->sense.scsi_sense, req->sense_vbuf,
-		sizeof(xs->sense.scsi_sense));
-	} else if (mpt_reply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_FAILED) {
-		/*
-		 * This will cause the scsipi layer to issue
-		 * a REQUEST SENSE.
-		 */
-		if (xs->status == SCSI_CHECK)
-			xs->error = XS_BUSY;
+	if (mpt_reply != NULL) {
+		if (mpt_reply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {
+			memcpy(&xs->sense.scsi_sense, req->sense_vbuf,
+			sizeof(xs->sense.scsi_sense));
+		} else if (mpt_reply->SCSIState &
+		MPI_SCSI_STATE_AUTOSENSE_FAILED) {
+			/*
+			 * This will cause the scsipi layer to issue
+			 * a REQUEST SENSE.
+			 */
+			if (xs->status == SCSI_CHECK)
+xs->error = XS_BUSY;
+		}
 	}
 
  done:



CVS commit: src/sys/dev/ic

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 16:05:45 UTC 2014

Modified Files:
src/sys/dev/ic: mpt_debug.c

Log Message:
CID/1203194, CID/1203195: Out of bounds read


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/mpt_debug.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mpt_debug.c
diff -u src/sys/dev/ic/mpt_debug.c:1.9 src/sys/dev/ic/mpt_debug.c:1.10
--- src/sys/dev/ic/mpt_debug.c:1.9	Thu Mar 27 14:28:26 2014
+++ src/sys/dev/ic/mpt_debug.c	Thu Apr 17 12:05:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_debug.c,v 1.9 2014/03/27 18:28:26 christos Exp $	*/
+/*	$NetBSD: mpt_debug.c,v 1.10 2014/04/17 16:05:45 christos Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 by Greg Ansley
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpt_debug.c,v 1.9 2014/03/27 18:28:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_debug.c,v 1.10 2014/04/17 16:05:45 christos Exp $");
 
 #include 
 
@@ -201,10 +201,10 @@ mpt_ioc_diag(u_int32_t code)
 		return tbuf;
 	while (status->Error_Code >= 0) {
 		if ((status->Error_Code & code) != 0) {
+			if (len >= sizeof(tbuf))
+return tbuf;
 			len += snprintf(tbuf + len, sizeof(tbuf) - len, "%s ",
 			status->Error_String);
-			if (len > sizeof(tbuf))
-return tbuf;
 		}
 		status++;
 	}
@@ -248,10 +248,10 @@ mpt_scsi_state(int code)
 		return tbuf;
 	while (status->Error_Code >= 0) {
 		if ((status->Error_Code & code) != 0) {
+			if (len >= sizeof(tbuf))
+return tbuf;
 			len += snprintf(tbuf + len, sizeof(tbuf) - len, "%s ",
 status->Error_String);
-			if (len > sizeof(tbuf))
-return tbuf;
 		}
 		status++;
 	}



CVS commit: src/sys/dev/ic

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 16:04:47 UTC 2014

Modified Files:
src/sys/dev/ic: aic79xx.c

Log Message:
CID/1203192, CID/1203193: Out of bounds read


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ic/aic79xx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/aic79xx.c
diff -u src/sys/dev/ic/aic79xx.c:1.47 src/sys/dev/ic/aic79xx.c:1.48
--- src/sys/dev/ic/aic79xx.c:1.47	Thu Mar 27 14:28:26 2014
+++ src/sys/dev/ic/aic79xx.c	Thu Apr 17 12:04:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic79xx.c,v 1.47 2014/03/27 18:28:26 christos Exp $	*/
+/*	$NetBSD: aic79xx.c,v 1.48 2014/04/17 16:04:47 christos Exp $	*/
 
 /*
  * Core routines and tables shareable across OS platforms.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.47 2014/03/27 18:28:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.48 2014/04/17 16:04:47 christos Exp $");
 
 #include 
 #include 
@@ -8605,13 +8605,11 @@ ahd_print_register(ahd_reg_parse_entry_t
 		*cur_column = 0;
 	}
 	printed = snprintf(line, sizeof(line), "%s[0x%x]", name, value);
-	if (printed > sizeof(line))
 		printed = sizeof(line);
 	if (table == NULL) {
-		printed += snprintf(&line[printed], (sizeof line) - printed,
-		" ");
-		if (printed > sizeof(line))
-			printed = sizeof(line);
+		if (printed < sizeof(line))
+		printed += snprintf(&line[printed],
+			(sizeof line) - printed,
 		printf("%s", line);
 		if (cur_column != NULL)
 			*cur_column += printed;
@@ -8627,12 +8625,11 @@ ahd_print_register(ahd_reg_parse_entry_t
 			 || ((printed_mask & table[entry].mask)
 			  == table[entry].mask))
 continue;
-			if (printed > sizeof(line))
-printed = sizeof(line);
-			printed += snprintf(&line[printed],
-			(sizeof line) - printed, "%s%s",
-printed_mask == 0 ? ":(" : "|",
-table[entry].name);
+			if (printed < sizeof(line))
+			printed += snprintf(&line[printed],
+(sizeof line) - printed, "%s%s",
+printed_mask == 0 ? ":(" : "|",
+table[entry].name);
 			printed_mask |= table[entry].mask;
 
 			break;
@@ -8640,14 +8637,14 @@ ahd_print_register(ahd_reg_parse_entry_t
 		if (entry >= num_entries)
 			break;
 	}
-	if (printed > sizeof(line))
-		printed = sizeof(line);
-	if (printed_mask != 0)
-		printed += snprintf(&line[printed],
-		(sizeof line) - printed, ") ");
-	else
-		printed += snprintf(&line[printed],
-		(sizeof line) - printed, " ");
+	if (printed < sizeof(line)) {
+		if (printed_mask != 0)
+			printed += snprintf(&line[printed],
+			(sizeof line) - printed, ") ");
+		else
+			printed += snprintf(&line[printed],
+			(sizeof line) - printed, " ");
+	}
 	if (cur_column != NULL)
 		*cur_column += printed;
 	printf("%s", line);



CVS commit: src/sys/arch/x86/acpi

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 16:01:24 UTC 2014

Modified Files:
src/sys/arch/x86/acpi: acpi_cpu_md.c

Log Message:
CID/1203191: Out of bounds read


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/x86/acpi/acpi_cpu_md.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.76 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.77
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.76	Thu Mar 27 14:22:56 2014
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Thu Apr 17 12:01:24 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.76 2014/03/27 18:22:56 christos Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.77 2014/04/17 16:01:24 christos Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.76 2014/03/27 18:22:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.77 2014/04/17 16:01:24 christos Exp $");
 
 #include 
 #include 
@@ -1150,11 +1150,11 @@ acpicpu_md_pstate_sysctl_all(SYSCTLFN_AR
 		if (sc->sc_pstate[i].ps_freq == 0)
 			continue;
 
+		if (len >= sizeof(buf))
+			break;
 		len += snprintf(buf + len, sizeof(buf) - len, "%u%s",
 		sc->sc_pstate[i].ps_freq,
 		i < (sc->sc_pstate_count - 1) ? " " : "");
-		if (len > sizeof(buf))
-			break;
 	}
 
 	mutex_exit(&sc->sc_mtx);



CVS commit: src/sys/ufs/lfs

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 15:57:41 UTC 2014

Modified Files:
src/sys/ufs/lfs: lfs_syscalls.c

Log Message:
CID/1203190: Fix NULL deref


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/lfs/lfs_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/lfs/lfs_syscalls.c
diff -u src/sys/ufs/lfs/lfs_syscalls.c:1.153 src/sys/ufs/lfs/lfs_syscalls.c:1.154
--- src/sys/ufs/lfs/lfs_syscalls.c:1.153	Wed Apr  9 18:44:15 2014
+++ src/sys/ufs/lfs/lfs_syscalls.c	Thu Apr 17 11:57:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_syscalls.c,v 1.153 2014/04/09 22:44:15 riastradh Exp $	*/
+/*	$NetBSD: lfs_syscalls.c,v 1.154 2014/04/17 15:57:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.153 2014/04/09 22:44:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.154 2014/04/17 15:57:41 christos Exp $");
 
 #ifndef LFS
 # define LFS		/* for prototypes in syscallargs.h */
@@ -754,7 +754,8 @@ lfs_bmapv(struct proc *p, fsid_t *fsidp,
 }
 numrefed++;
 			} else {
-mutex_exit(vp->v_interlock);
+if (vp != null)
+	mutex_exit(vp->v_interlock);
 mutex_exit(&ulfs_ihash_lock);
 /*
  * Don't VFS_VGET if we're being unmounted,



CVS commit: src/sys/dev/ic

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 15:55:53 UTC 2014

Modified Files:
src/sys/dev/ic: mpt_netbsd.c

Log Message:
CID 1203189: Null deref.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/mpt_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mpt_netbsd.c
diff -u src/sys/dev/ic/mpt_netbsd.c:1.22 src/sys/dev/ic/mpt_netbsd.c:1.23
--- src/sys/dev/ic/mpt_netbsd.c:1.22	Tue Apr 15 01:27:54 2014
+++ src/sys/dev/ic/mpt_netbsd.c	Thu Apr 17 11:55:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_netbsd.c,v 1.22 2014/04/15 05:27:54 buhrow Exp $	*/
+/*	$NetBSD: mpt_netbsd.c,v 1.23 2014/04/17 15:55:53 christos Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.22 2014/04/15 05:27:54 buhrow Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.23 2014/04/17 15:55:53 christos Exp $");
 
 #include 			/* pulls in all headers */
 #include 
@@ -540,13 +540,15 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 		if (mpt_reply != NULL)
 			mpt_ctlop(mpt, mpt_reply, reply);
 		else
-			mpt_prt(mpt, "mpt_done: index 0x%x, NULL reply", index);
+			mpt_prt(mpt, "%s: index 0x%x, NULL reply", __func__,
+			index);
 		return;
 	}
 
 	/* Did we end up with a valid index into the table? */
 	if (__predict_false(index < 0 || index >= MPT_MAX_REQUESTS(mpt))) {
-		mpt_prt(mpt, "mpt_done: invalid index (0x%x) in reply", index);
+		mpt_prt(mpt, "%s: invalid index (0x%x) in reply", __func__,
+		index);
 		return;
 	}
 
@@ -554,7 +556,8 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 
 	/* Make sure memory hasn't been trashed. */
 	if (__predict_false(req->index != index)) {
-		mpt_prt(mpt, "mpt_done: corrupted request_t (0x%x)", index);
+		mpt_prt(mpt, "%s: corrupted request_t (0x%x)", __func__,
+		index);
 		return;
 	}
 
@@ -564,7 +567,7 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 	/* Short cut for task management replies; nothing more for us to do. */
 	if (__predict_false(mpt_req->Function == MPI_FUNCTION_SCSI_TASK_MGMT)) {
 		if (mpt->verbose > 1)
-			mpt_prt(mpt, "mpt_done: TASK MGMT");
+			mpt_prt(mpt, "%s: TASK MGMT", __func__);
 		KASSERT(req == mpt->mngt_req);
 		mpt->mngt_req = NULL;
 		goto done;
@@ -580,8 +583,8 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 	if (__predict_false(mpt_req->Function !=
 			MPI_FUNCTION_SCSI_IO_REQUEST)) {
 		if (mpt->verbose > 1)
-			mpt_prt(mpt, "mpt_done: unknown Function 0x%x (0x%x)",
-			mpt_req->Function, index);
+			mpt_prt(mpt, "%s: unknown Function 0x%x (0x%x)",
+			__func__, mpt_req->Function, index);
 		goto done;
 	}
 
@@ -591,7 +594,7 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 	/* Can't have a SCSI command without a scsipi_xfer. */
 	if (__predict_false(xs == NULL)) {
 		mpt_prt(mpt,
-		"mpt_done: no scsipi_xfer, index = 0x%x, seq = 0x%08x",
+		"%s: no scsipi_xfer, index = 0x%x, seq = 0x%08x", __func__,
 		req->index, req->sequence);
 		mpt_prt(mpt, "request state: %s", mpt_req_state(req->debug));
 		mpt_prt(mpt, "mpt_request:");
@@ -646,7 +649,7 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 	switch (le16toh(mpt_reply->IOCStatus) & MPI_IOCSTATUS_MASK) {
 	case MPI_IOCSTATUS_SCSI_DATA_OVERRUN:
 		xs->error = XS_DRIVER_STUFFUP;
-		mpt_prt(mpt,"mpt_done: IOC overrun!");
+		mpt_prt(mpt, "%s: IOC overrun!", __func__);
 		break;
 
 	case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN:
@@ -705,34 +708,34 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 
 	case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:
 		xs->error = XS_DRIVER_STUFFUP;
-		mpt_prt(mpt,"mpt_done: IOC SCSI residual mismatch!");
+		mpt_prt(mpt, "%s: IOC SCSI residual mismatch!", __func__);
 		restart = 1;
 		break;
 
 	case MPI_IOCSTATUS_SCSI_TASK_TERMINATED:
 		/* XXX What should we do here? */
-		mpt_prt(mpt,"mpt_done: IOC SCSI task terminated!");
+		mpt_prt(mpt, "%s: IOC SCSI task terminated!", __func__);
 		restart = 1;
 		break;
 
 	case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED:
 		/* XXX */
 		xs->error = XS_DRIVER_STUFFUP;
-		mpt_prt(mpt,"mpt_done: IOC SCSI task failed!");
+		mpt_prt(mpt, "%s: IOC SCSI task failed!", __func__);
 		restart = 1;
 		break;
 
 	case MPI_IOCSTATUS_SCSI_IOC_TERMINATED:
 		/* XXX */
 		xs->error = XS_DRIVER_STUFFUP;
-		mpt_prt(mpt,"mpt_done: IOC task terminated!");
+		mpt_prt(mpt, "%s: IOC task terminated!", __func__);
 		restart = 1;
 		break;
 
 	case MPI_IOCSTATUS_SCSI_EXT_TERMINATED:
 		/* XXX This is a bus-reset */
 		xs->error = XS_DRIVER_STUFFUP;
-		mpt_prt(mpt,"mpt_done: IOC SCSI bus reset!");
+		mpt_prt(mpt, "%s: IOC SCSI bus reset!", __func__);
 		restart = 1;
 		break;
 
@@ -740,10 +743,12 @@ mpt_done(mpt_softc_t *mpt, uint32_t repl
 		/*
 		 * FreeBSD and Linux indicate this is a phase error between
 		 * the IOC and the drive itself. When this happens, the IOC
-		* becomes unhappy and stops processing all transactions.  
-		

CVS commit: src/sys/net

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 15:45:39 UTC 2014

Modified Files:
src/sys/net: if.h

Log Message:
add LRO


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/net/if.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.161 src/sys/net/if.h:1.162
--- src/sys/net/if.h:1.161	Wed Mar 12 08:59:57 2014
+++ src/sys/net/if.h	Thu Apr 17 11:45:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.161 2014/03/12 12:59:57 pooka Exp $	*/
+/*	$NetBSD: if.h,v 1.162 2014/04/17 15:45:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -401,7 +401,8 @@ typedef struct ifnet {
 #define	IFCAP_CSUM_UDPv6_Rx	0x1	/* can do IPv6/UDP checksums (Rx) */
 #define	IFCAP_CSUM_UDPv6_Tx	0x2	/* can do IPv6/UDP checksums (Tx) */
 #define	IFCAP_TSOv6		0x4	/* can do TCPv6 segmentation offload */
-#define	IFCAP_MASK		0x7ff80 /* currently valid capabilities */
+#define	IFCAP_LRO		0x8	/* can do Large Receive Offload */
+#define	IFCAP_MASK		0xfff80 /* currently valid capabilities */
 
 #define	IFCAPBITS		\
 	"\020"			\
@@ -416,7 +417,8 @@ typedef struct ifnet {
 	"\20TCP6CSUM_Tx"	\
 	"\21UDP6CSUM_Rx"	\
 	"\22UDP6CSUM_Tx"	\
-	"\23TSO6"
+	"\23TSO6"		\
+	"\24LRO"		\
 
 /*
  * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)



CVS commit: src/sys/dev/pci/ixgbe

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 15:35:49 UTC 2014

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_phy.c

Log Message:
CIT 744275: Increase max_retry so we retry once.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/ixgbe_phy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_phy.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.1 src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.2
--- src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.1	Fri Aug 12 17:55:29 2011
+++ src/sys/dev/pci/ixgbe/ixgbe_phy.c	Thu Apr 17 11:35:49 2014
@@ -31,7 +31,7 @@
 
 **/
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe_phy.c,v 1.11 2010/11/26 22:46:32 jfv Exp $*/
-/*$NetBSD: ixgbe_phy.c,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
+/*$NetBSD: ixgbe_phy.c,v 1.2 2014/04/17 15:35:49 christos Exp $*/
 
 #include "ixgbe_api.h"
 #include "ixgbe_common.h"
@@ -1399,7 +1399,7 @@ s32 ixgbe_write_i2c_byte_generic(struct 
  u8 dev_addr, u8 data)
 {
 	s32 status = IXGBE_SUCCESS;
-	u32 max_retry = 1;
+	u32 max_retry = 2;
 	u32 retry = 0;
 	u16 swfw_mask = 0;
 



CVS commit: src/sys/dev/pci/ixgbe

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 15:34:05 UTC 2014

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_82599.c

Log Message:
CID 140077: Add missing break and FALLTHROUGH


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/ixgbe/ixgbe_82599.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_82599.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.2 src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.3
--- src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.2	Tue Apr  8 15:39:06 2014
+++ src/sys/dev/pci/ixgbe/ixgbe_82599.c	Thu Apr 17 11:34:05 2014
@@ -31,7 +31,7 @@
 
 **/
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe_82599.c,v 1.6 2011/01/19 19:36:27 jfv Exp $*/
-/*$NetBSD: ixgbe_82599.c,v 1.2 2014/04/08 19:39:06 christos Exp $*/
+/*$NetBSD: ixgbe_82599.c,v 1.3 2014/04/17 15:34:05 christos Exp $*/
 
 #include "ixgbe_type.h"
 #include "ixgbe_api.h"
@@ -1677,6 +1677,7 @@ s32 ixgbe_fdir_add_perfect_filter_82599(
 	case IXGBE_ATR_FLOW_TYPE_IPV4:
 		/* use the L4 protocol mask for raw IPv4/IPv6 traffic */
 		fdirm |= IXGBE_FDIRM_L4P;
+		break;
 	case IXGBE_ATR_FLOW_TYPE_SCTPV4:
 		if (input_masks->dst_port_mask || input_masks->src_port_mask) {
 			DEBUGOUT(" Error on src/dst port mask\n");
@@ -1705,6 +1706,7 @@ s32 ixgbe_fdir_add_perfect_filter_82599(
 	case 0xEFFF:
 		/* Unmask VLAN ID - bit 0 and fall through to unmask prio */
 		fdirm &= ~IXGBE_FDIRM_VLANID;
+		/*FALLTHROUGH*/
 	case 0xE000:
 		/* Unmask VLAN prio - bit 1 */
 		fdirm &= ~IXGBE_FDIRM_VLANP;



CVS commit: src/sys/dev/pci/ixgbe

2014-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 17 15:33:40 UTC 2014

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_common.c

Log Message:
CID 141398: Fix incorrect test


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/ixgbe_common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.1 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.2
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.1	Fri Aug 12 17:55:29 2011
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Thu Apr 17 11:33:40 2014
@@ -31,7 +31,7 @@
 
 **/
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe_common.c,v 1.12 2011/01/19 19:36:27 jfv Exp $*/
-/*$NetBSD: ixgbe_common.c,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
+/*$NetBSD: ixgbe_common.c,v 1.2 2014/04/17 15:33:40 christos Exp $*/
 
 #include "ixgbe_common.h"
 #include "ixgbe_phy.h"
@@ -2181,7 +2181,7 @@ static s32 ixgbe_fc_autoneg_fiber(struct
 
 	linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA);
 	if (((linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) ||
-	((linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) {
+	((linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) != 0)) {
 		ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
 		goto out;
 	}



CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm

2014-04-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Apr 17 13:48:02 UTC 2014

Modified Files:
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c

Log Message:
Fix count vs ret confusion. ret is only set on error when count == 0 -
make sure this is the case.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.11 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.12
--- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.11	Thu Mar 27 23:03:07 2014
+++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c	Thu Apr 17 13:48:02 2014
@@ -715,7 +715,6 @@ vchiq_ioctl(struct file *fp, u_long cmd,
 
 	case VCHIQ_IOC_AWAIT_COMPLETION: {
 		VCHIQ_AWAIT_COMPLETION_T *pargs = arg;
-		int count = 0;
 
 		DEBUG_TRACE(AWAIT_COMPLETION_LINE);
 		if (!instance->connected) {
@@ -750,6 +749,8 @@ vchiq_ioctl(struct file *fp, u_long cmd,
 
 		if (ret == 0) {
 			int msgbufcount = pargs->msgbufcount;
+			int count;
+
 			for (count = 0; count < pargs->count; count++) {
 VCHIQ_COMPLETION_DATA_T *completion;
 VCHIQ_SERVICE_T *service1;
@@ -831,7 +832,7 @@ vchiq_ioctl(struct file *fp, u_long cmd,
 	count * sizeof(VCHIQ_COMPLETION_DATA_T)),
 	completion,
 	sizeof(VCHIQ_COMPLETION_DATA_T)) != 0) {
-		if (ret == 0)
+		if (count == 0)
 			ret = -EFAULT;
 	break;
 }
@@ -843,7 +844,7 @@ vchiq_ioctl(struct file *fp, u_long cmd,
 			pargs->count = count;
 		}
 
-		if ((ret == 0 && count > 0) || ret != 0)
+		if (ret != 0)
 			up(&instance->remove_event);
 		lmutex_unlock(&instance->completion_mutex);
 		DEBUG_TRACE(AWAIT_COMPLETION_LINE);



CVS commit: src/sys/arch/hp300/stand/common

2014-04-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 17 12:35:24 UTC 2014

Modified Files:
src/sys/arch/hp300/stand/common: apci.c

Log Message:
Check the service switch on 425e to select apci serial console.

Taken from OpenBSD/hp300.  See the following comment for details:
>> * Check the service switch. On the 425e, this is a physical
>> * switch, unlike other frodo-based machines, so we can use it
>> * as a serial vs internal video selector, since the PROM can not
>> * be configured for serial console.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/apci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp300/stand/common/apci.c
diff -u src/sys/arch/hp300/stand/common/apci.c:1.12 src/sys/arch/hp300/stand/common/apci.c:1.13
--- src/sys/arch/hp300/stand/common/apci.c:1.12	Thu Apr 10 18:10:09 2014
+++ src/sys/arch/hp300/stand/common/apci.c	Thu Apr 17 12:35:24 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: apci.c,v 1.12 2014/04/10 18:10:09 tsutsui Exp $	*/
+/*	$NetBSD: apci.c,v 1.13 2014/04/17 12:35:24 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
@@ -84,9 +84,7 @@ struct apciregs *apcicnaddr = 0;
 void
 apciprobe(struct consdev *cp)
 {
-
-	apcicnaddr =
-	(void *)IIOV(INTIOBASE + FRODO_BASE + FRODO_APCI_OFFSET(1));
+	volatile uint8_t *frodoregs;
 
 	cp->cn_pri = CN_DEAD;
 
@@ -97,12 +95,26 @@ apciprobe(struct consdev *cp)
 	if (machineid != HP_425 || mmuid != MMUID_425_E)
 		return;
 
+	/*
+	 * Check the service switch. On the 425e, this is a physical
+	 * switch, unlike other frodo-based machines, so we can use it
+	 * as a serial vs internal video selector, since the PROM can not
+	 * be configured for serial console.
+	 */
+	frodoregs = (volatile u_int8_t *)IIOV(INTIOBASE + FRODO_BASE);
+	if (badaddr((char *)frodoregs) == 0 &&
+	(frodoregs[FRODO_IISR] & FRODO_IISR_SERVICE) == 0)
+		cp->cn_pri = CN_REMOTE;
+	else
+		cp->cn_pri = CN_NORMAL;
+
 #ifdef FORCEAPCICONSOLE
 	cp->cn_pri = CN_REMOTE;
-#else
-	cp->cn_pri = CN_NORMAL;
 #endif
 	curcons_scode = -2;
+
+	apcicnaddr =
+	(void *)IIOV(INTIOBASE + FRODO_BASE + FRODO_APCI_OFFSET(1));
 }
 
 void