Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Sep 2012 07:47:03 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r240260 - stable/7/sys/cddl/compat/opensolaris/sys
Message-ID:  <201209090747.q897l3he027769@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mm
Date: Sun Sep  9 07:47:02 2012
New Revision: 240260
URL: http://svn.freebsd.org/changeset/base/240260

Log:
  MFC r240162:
  Make r230454 more readable and vendor-like.
  
  PR:	kern/171380

Modified:
  stable/7/sys/cddl/compat/opensolaris/sys/sid.h
Directory Properties:
  stable/7/sys/   (props changed)

Modified: stable/7/sys/cddl/compat/opensolaris/sys/sid.h
==============================================================================
--- stable/7/sys/cddl/compat/opensolaris/sys/sid.h	Sun Sep  9 07:46:45 2012	(r240259)
+++ stable/7/sys/cddl/compat/opensolaris/sys/sid.h	Sun Sep  9 07:47:02 2012	(r240260)
@@ -30,7 +30,8 @@
 #define	_OPENSOLARIS_SYS_SID_H_
 
 typedef struct ksiddomain {
-	char	kd_name[1];	/* Domain part of SID */
+	char	*kd_name;	/* Domain part of SID */
+	uint_t	kd_len;
 } ksiddomain_t;
 typedef void	ksid_t;
 
@@ -38,8 +39,12 @@ static __inline ksiddomain_t *
 ksid_lookupdomain(const char *domain)
 {
 	ksiddomain_t *kd;
+	size_t len;
 
-	kd = kmem_alloc(sizeof(*kd) + strlen(domain), KM_SLEEP);
+	len = strlen(domain) + 1;
+	kd = kmem_alloc(sizeof(*kd), KM_SLEEP);
+	kd->kd_len = (uint_t)len;
+	kd->kd_name = kmem_alloc(len, KM_SLEEP);
 	strcpy(kd->kd_name, domain);
 	return (kd);
 }
@@ -48,6 +53,7 @@ static __inline void
 ksiddomain_rele(ksiddomain_t *kd)
 {
 
+	kmem_free(kd->kd_name, kd->kd_len);
 	kmem_free(kd, sizeof(*kd));
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209090747.q897l3he027769>