svn commit: r300483 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Mon May 23 07:17:53 2016 New Revision: 300483 URL: https://svnweb.freebsd.org/changeset/base/300483 Log: MFC r300024: zfs_ioc_rename: fix a reversed condition PR: 209093 Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c == --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon May 23 07:15:23 2016(r300482) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon May 23 07:17:53 2016(r300483) @@ -3804,7 +3804,7 @@ zfs_ioc_rename(zfs_cmd_t *zc) #ifdef illumos if (zc->zc_objset_type == DMU_OST_ZFS) { #else - if (zc->zc_objset_type == DMU_OST_ZFS && allow_mounted) { + if (zc->zc_objset_type == DMU_OST_ZFS && !allow_mounted) { #endif error = dmu_objset_find(zc->zc_name, recursive_unmount, at + 1, ___ svn-src-stable-9@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9 To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"
svn commit: r300485 - stable/9/sys/kern
Author: avg Date: Mon May 23 07:21:16 2016 New Revision: 300485 URL: https://svnweb.freebsd.org/changeset/base/300485 Log: MFC r299916: vfs_read_dirent: increment ncookies after adding a cookie Modified: stable/9/sys/kern/vfs_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_subr.c == --- stable/9/sys/kern/vfs_subr.cMon May 23 07:21:01 2016 (r300484) +++ stable/9/sys/kern/vfs_subr.cMon May 23 07:21:16 2016 (r300485) @@ -4687,6 +4687,7 @@ vfs_read_dirent(struct vop_readdir_args *ap->a_cookies = realloc(*ap->a_cookies, (*ap->a_ncookies + 1) * sizeof(u_long), M_TEMP, M_WAITOK | M_ZERO); (*ap->a_cookies)[*ap->a_ncookies] = off; + *ap->a_ncookies += 1; return (0); } ___ svn-src-stable-9@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9 To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"
svn commit: r300554 - stable/9/usr.bin/sed
Author: pfg Date: Tue May 24 03:00:24 2016 New Revision: 300554 URL: https://svnweb.freebsd.org/changeset/base/300554 Log: MFV r299377: sed.1: Correction for the case insensitive case. Use the capital I instead of the lowercase. Submitted by: Mikhail T. Modified: stable/9/usr.bin/sed/sed.1 Directory Properties: stable/9/usr.bin/sed/ (props changed) Modified: stable/9/usr.bin/sed/sed.1 == --- stable/9/usr.bin/sed/sed.1 Tue May 24 02:57:13 2016(r300553) +++ stable/9/usr.bin/sed/sed.1 Tue May 24 03:00:24 2016(r300554) @@ -196,7 +196,7 @@ option was specified); a context address that consists of a regular expression preceded and followed by a delimiter. The closing delimiter can also optionally be followed by the -.Dq i +.Dq I character, to indicate that the regular expression is to be matched in a case-insensitive way. .El ___ svn-src-stable-9@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9 To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"
svn commit: r300558 - stable/9/usr.sbin/bsnmpd/tools/libbsnmptools
Author: ngie Date: Tue May 24 04:18:15 2016 New Revision: 300558 URL: https://svnweb.freebsd.org/changeset/base/300558 Log: MFstable/10 r300471: MFC r299712,r299759,r299760,r299761,r299762: r299712: Fix some trivial clang/gcc warnings in bsnmptc.c - By definition, `enum snmp_tc` can't be false (the implied starting sequence index for the enum is 0). Don't test for it being < 0. - Staticize `struct snmp_text_conv` to mute a -Wmissing-variable-declarations warning from clang. - Remove set but unused variable, ptr, in parse_bridge_id(..) and parse_bport_id(..) to mute warning from gcc 4.9+. - Mark value and string unused in snmp_inetaddr2oct(..) and parse_inetaddr(..) as they're just stub functions. r299759: Use calloc instead of memset(.., 0, ..) + malloc r299760: Sort variables in parse_ascii(..) per style(9) r299761: parse_ascii: make count size_t to mute a -Wsign-compare issue count is always unsigned. r299762: Mark snmptoolctx unused in parse_authentication(..), parse_privacy(..), parse_context(..), and parse_user_security(..). Modified: stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/bsnmpd/ (props changed) Modified: stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c == --- stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Tue May 24 03:15:46 2016(r300557) +++ stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Tue May 24 04:18:15 2016(r300558) @@ -93,7 +93,7 @@ static char *snmp_oct2bits(uint32_t len, static char *snmp_bits2oct(char *str, struct asn_oid *oid); static int32_t parse_bits(struct snmp_value *value, char *string); -struct snmp_text_conv { +static struct snmp_text_conv { enum snmp_tctc; const char *tc_str; int32_t len; @@ -158,7 +158,7 @@ snmp_oct2tc(enum snmp_tc tc, uint32_t le uint32_t tc_len; char * buf; - if (tc < 0 || tc > SNMP_UNKNOWN) + if (tc > SNMP_UNKNOWN) tc = SNMP_UNKNOWN; if (text_convs[tc].len > 0) @@ -183,7 +183,7 @@ snmp_oct2tc(enum snmp_tc tc, uint32_t le char * snmp_tc2oid(enum snmp_tc tc, char *str, struct asn_oid *oid) { - if (tc < 0 || tc > SNMP_UNKNOWN) + if (tc > SNMP_UNKNOWN) tc = SNMP_UNKNOWN; return (text_convs[tc].tc2oid(str, oid)); @@ -192,7 +192,7 @@ snmp_tc2oid(enum snmp_tc tc, char *str, int32_t snmp_tc2oct(enum snmp_tc tc, struct snmp_value *value, char *string) { - if (tc < 0 || tc > SNMP_UNKNOWN) + if (tc > SNMP_UNKNOWN) tc = SNMP_UNKNOWN; return (text_convs[tc].tc2oct(value, string)); @@ -929,12 +929,11 @@ snmp_bridgeid2oct(char *str, struct asn_ static int32_t parse_bridge_id(struct snmp_value *sv, char *string) { - char *ptr, *endptr; + char *endptr; int32_t i, saved_errno; uint32_t v; uint8_t bridge_id[SNMP_BRIDGEID_OCTETS]; - ptr = string; /* Read the priority. */ saved_errno = errno; errno = 0; @@ -1057,12 +1056,11 @@ snmp_bport_id2oct(char *str, struct asn_ static int32_t parse_bport_id(struct snmp_value *value, char *string) { - char *ptr, *endptr; + char *endptr; int saved_errno; uint32_t v; uint8_t bport_id[SNMP_BPORT_OCTETS]; - ptr = string; /* Read the priority. */ saved_errno = errno; errno = 0; @@ -1175,13 +1173,13 @@ snmp_oct2inetaddr(uint32_t len, char *oc } static char * -snmp_inetaddr2oct(char *str, struct asn_oid *oid) +snmp_inetaddr2oct(char *str __unused, struct asn_oid *oid __unused) { return (NULL); } static int32_t -parse_inetaddr(struct snmp_value *value, char *string) +parse_inetaddr(struct snmp_value *value __unused, char *string __unused) { return (-1); } Modified: stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c == --- stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Tue May 24 03:15:46 2016(r300557) +++ stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Tue May 24 04:18:15 2016(r300558) @@ -255,14 +255,12 @@ add_filename(struct snmp_toolinfo *snmpt return (-1); } - if ((entry = malloc(sizeof(struct fname))) == NULL) { + if ((entry = calloc(1, sizeof(struct fname))) == NULL) { warnx("malloc() failed - %s", strerror(errno)); free(fstring); return (-1); } - memset(entry, 0, sizeof(struct fname)); - if (cut != NULL) asn_append_oid(&(entry->cut), cut);
svn commit: r300560 - stable/9/usr.sbin/bsnmpd/tools/libbsnmptools
Author: ngie Date: Tue May 24 04:34:45 2016 New Revision: 300560 URL: https://svnweb.freebsd.org/changeset/base/300560 Log: MFC r299764,r299765,r299769,r299770,r299774,r299802,r299803,r299805,r299814: r299764: Use the size of the destination buffer, not the source buffer. Technically this is a no-op, but mute the clang warning in case the malloc call above for fstring ever changes in the future r299765: Fix theoretical buffer overflow issues in snmp_oid2asn_oid Increase the size of `string` by 1 to account for the '\0' terminator. In the event that `str` doesn't contain any non-alpha chars, i would be set to MAXSTR, and the subsequent strlcpy call would overflow by a character. Remove unnecessary `string[i] = '\0'` -- this is already handled by strlcpy. r299769: Use the size of the destination buffer instead of the malloc size, repeated, in order to mute a -Wstrlcpy-strlcat-size warning r299770: Fix up r299764 I meant to use nitems, not sizeof(..) with the destination buffer. Using sizeof(..) on a pointer will always truncate the output in the destination buffer incorrectly Pointyhat to: ngie r299774: Do minimal work necessary to cure a -Wunused-but-set-variable warning from gcc How errno is saved before and restored after strtoul calls needs a rethink r299802: Fix up both r299764 and r299770 nitems was wrong too, as it was being tested against a pointer instead of a buffer on the stack. Since the old code was just doing malloc, then strlcpy'ing the contents of the source buffer into the destination buffer, replace it all with a call to strdup.. Supersized Duncecap to: ngie r299803: Replace malloc + memset(.., 0, ..) with calloc calls r299805: Fix up r299769 Similar to r299802, it was noted that using nitems on scalar pointers is invalid. Use strdup instead of malloc + strlcpy (which is what the old code was doing anyhow). Pointyhat to: ngie r299814: Replace malloc + memset(.., 0, ..) with calloc calls Modified: stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/bsnmpd/ (props changed) Modified: stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c == --- stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Tue May 24 04:23:58 2016(r300559) +++ stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Tue May 24 04:34:45 2016(r300560) @@ -56,12 +56,11 @@ snmp_mapping_init(void) { struct snmp_mappings *m; - if ((m = malloc(sizeof(struct snmp_mappings))) == NULL) { + if ((m = calloc(1, sizeof(struct snmp_mappings))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (NULL); } - memset(m, 0, sizeof(struct snmp_mappings)); return (m); } @@ -269,21 +268,18 @@ enum_pair_insert(struct enum_pairs *head { struct enum_pair *e_new; - if ((e_new = malloc(sizeof(struct enum_pair))) == NULL) { + if ((e_new = calloc(1, sizeof(struct enum_pair))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (-1); } - memset(e_new, 0, sizeof(struct enum_pair)); - - if ((e_new->enum_str = malloc(strlen(enum_str) + 1)) == NULL) { + if ((e_new->enum_str = strdup(enum_str)) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); free(e_new); return (-1); } e_new->enum_val = enum_val; - strlcpy(e_new->enum_str, enum_str, strlen(enum_str) + 1); STAILQ_INSERT_TAIL(headp, e_new, link); return (1); @@ -482,13 +478,11 @@ snmp_syntax_insert(struct snmp_idxlist * { struct index *idx; - if ((idx = malloc(sizeof(struct index))) == NULL) { + if ((idx = calloc(1, sizeof(struct index))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (-1); } - memset(idx, 0, sizeof(struct index)); - if (snmp_index_insert(headp, idx) < 0) { free(idx); return (-1); @@ -558,18 +552,16 @@ snmp_enumtc_init(char *name) { struct enum_type *enum_tc; - if ((enum_tc = malloc(sizeof(struct enum_type))) == NULL) { + if ((enum_tc = calloc(1, sizeof(struct enum_type))) == NULL) { syslog(LOG_ERR, "malloc() failed: %s", strerror(errno)); return (NULL); } - memset(enum_tc, 0, sizeof(struct enum_type)); - if ((enum_tc->name = malloc(strlen(name) + 1)) =
svn commit: r300566 - in stable/9: contrib/bsnmp/snmp_usm contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd
Author: ngie Date: Tue May 24 05:11:55 2016 New Revision: 300566 URL: https://svnweb.freebsd.org/changeset/base/300566 Log: MFstable/10 r233128,r300561: r233128 (by harti): memset() wants the size of the structure to clear, not the size of the pointer to it. r300561: MFC r299465,r299807,r299808,r299817,r299831,r299832,r300167: r299465 (by cem): bsnmp: Don't overrun privkey buffer by copying wrong size The 'priv_key' array is SNMP_PRIV_KEY_SIZ bytes, not SNMP_AUTH_KEY_SIZ. CIDs: 1008326, 1009675 r299807: Replace QUADFMT with %ju and QUADXFMT with %jx and cast values with uintmax_t This will cure some -Wformat warnings r299808: Use sizeof(..)s for the destination buffers instead of hardcoded values corresponding to the destination buffer sizes r299817: Use SNMPD_INPUT_FAILED instead of SNMP_CODE_FAILED SNMPD_INPUT_FAILED is `enum snmpd_input_err` type (which matches the return code from the function). SNMP_CODE_FAILED is `enum snmp_code` type. r299831: Remove NO_WERROR and add WARNS?= 6 This now compiles cleanly on all architectures Tested with: clang 3.8, gcc 4.2.1, gcc 4.5, make tinderbox r299832: Remove trailing whitespace in license tort r300167 (by glebius): Revert r299830, it has couple of fatal errors. The CMSG_ family of macros take care of alignment, so we don't need r299830 at all, even if it was correct. Put NO_WCAST_ALIGN into Makefile. Together with:peter Modified: stable/9/contrib/bsnmp/snmp_usm/usm_snmp.c stable/9/contrib/bsnmp/snmpd/bsnmpd.1 stable/9/contrib/bsnmp/snmpd/config.c stable/9/contrib/bsnmp/snmpd/main.c stable/9/usr.sbin/bsnmpd/bsnmpd/Makefile Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/bsnmp/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/bsnmpd/ (props changed) Modified: stable/9/contrib/bsnmp/snmp_usm/usm_snmp.c == --- stable/9/contrib/bsnmp/snmp_usm/usm_snmp.c Tue May 24 05:06:01 2016 (r300565) +++ stable/9/contrib/bsnmp/snmp_usm/usm_snmp.c Tue May 24 05:11:55 2016 (r300566) @@ -262,7 +262,7 @@ op_usm_users(struct snmp_context *ctx, s if (ctx->scratch->ptr1 == NULL) return (SNMP_ERR_GENERR); memcpy(ctx->scratch->ptr1, uuser->suser.priv_key, - SNMP_PRIV_KEY_SIZ); + sizeof(uuser->suser.priv_key)); memcpy(uuser->suser.priv_key, val->v.octetstring.octets, val->v.octetstring.len); break; @@ -286,7 +286,7 @@ op_usm_users(struct snmp_context *ctx, s uuser->user_public_len = val->v.octetstring.len; } else { memset(uuser->user_public, 0, - SNMP_ADM_STR32_SIZ); + sizeof(uuser->user_public)); uuser->user_public_len = 0; } break; @@ -351,7 +351,7 @@ op_usm_users(struct snmp_context *ctx, s case LEAF_usmUserAuthKeyChange: case LEAF_usmUserOwnAuthKeyChange: memcpy(uuser->suser.auth_key, ctx->scratch->ptr1, - SNMP_AUTH_KEY_SIZ); + sizeof(uuser->suser.auth_key)); free(ctx->scratch->ptr1); break; case LEAF_usmUserPrivProtocol: @@ -360,7 +360,7 @@ op_usm_users(struct snmp_context *ctx, s case LEAF_usmUserPrivKeyChange: case LEAF_usmUserOwnPrivKeyChange: memcpy(uuser->suser.priv_key, ctx->scratch->ptr1, - SNMP_AUTH_KEY_SIZ); + sizeof(uuser->suser.priv_key)); free(ctx->scratch->ptr1); break; case LEAF_usmUserPublic: @@ -371,7 +371,7 @@ op_usm_users(struct snmp_context *ctx, s free(ctx->scratch->ptr2); } else { memset(uuser->user_public, 0, - SNMP_ADM_STR32_SIZ); + sizeof(uuser->user_public)); uuser->user_public_len = 0; } break; Modified: stable/9/contrib/bsnmp/snmpd/bsnmpd.1 == --- stable/9/contrib/bsnmp/snmpd/bsnmpd.1 Tue May 24 05:06:01 2016 (r300565) +++ stable/9/contrib/bsnmp/snmpd/bsnmpd.1 Tue May 24 05:11:55 2016 (r300566) @@ -7