rpms/numactl/devel numactl-1.0.2-cpumask.patch, NONE, 1.1 numactl.spec, 1.50, 1.51

Neil Horman (nhorman) fedora-extras-commits at redhat.com
Fri Apr 25 13:14:05 UTC 2008


Author: nhorman

Update of /cvs/extras/rpms/numactl/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv23653

Modified Files:
	numactl.spec 
Added Files:
	numactl-1.0.2-cpumask.patch 
Log Message:
Resolves: bz 442521

numactl-1.0.2-cpumask.patch:

--- NEW FILE numactl-1.0.2-cpumask.patch ---
diff -up numactl-1.0.2/numactl.c.orig numactl-1.0.2/numactl.c
--- numactl-1.0.2/numactl.c.orig	2007-09-21 06:23:51.000000000 -0400
+++ numactl-1.0.2/numactl.c	2008-04-25 09:10:05.000000000 -0400
@@ -355,14 +355,14 @@ int main(int ac, char **av)
 			break;
 		case 'C': /* --physcpubind */
 		{
-			int ncpus;
+			int bufsz;
 			unsigned long *cpubuf;
 			dontshm("-C/--physcpubind");
-			cpubuf = cpumask(optarg, &ncpus);
+			cpubuf = cpumask(optarg, &bufsz);
 			errno = 0;
 			check_cpubind(do_shm);
 			did_cpubind = 1;
-			numa_sched_setaffinity(0, CPU_BYTES(ncpus), cpubuf);
+			numa_sched_setaffinity(0, bufsz, cpubuf);
 			checkerror("sched_setaffinity");
 			free(cpubuf);
 			break;
diff -up numactl-1.0.2/util.h.orig numactl-1.0.2/util.h
--- numactl-1.0.2/util.h.orig	2007-08-16 10:36:23.000000000 -0400
+++ numactl-1.0.2/util.h	2008-04-25 09:10:05.000000000 -0400
@@ -1,7 +1,7 @@
 extern void printmask(char *name, nodemask_t *mask);
 extern void printcpumask(char *name, unsigned long *mask, int len);
 extern nodemask_t nodemask(char *s);
-extern unsigned long *cpumask(char *s, int *ncpus);
+extern unsigned long *cpumask(char *s, int *bufsz);
 extern int read_sysctl(char *name);
 extern void complain(char *fmt, ...);
 extern void nerror(char *fmt, ...);
diff -up numactl-1.0.2/util.c.orig numactl-1.0.2/util.c
--- numactl-1.0.2/util.c.orig	2007-08-16 10:36:23.000000000 -0400
+++ numactl-1.0.2/util.c	2008-04-25 09:10:45.000000000 -0400
@@ -52,7 +52,7 @@ void printmask(char *name, nodemask_t *m
 int numcpus; 
 
 /* caller must free buffer */
-unsigned long *cpumask(char *s, int *ncpus) 
+unsigned long *cpumask(char *s, int *bufsz) 
 {
 	int invert = 0;
 	char *end; 
@@ -92,7 +92,7 @@ unsigned long *cpumask(char *s, int *ncp
 			unsigned long arg2 = strtoul(++s, &end2, 0); 
 			if (end2 == s)
 				complain("missing cpu argument %s\n", s);
-			if (arg > numcpus)
+			if (arg >= numcpus)
 				complain("cpu argument %d out of range\n", arg);
 			while (++arg <= arg2)
 				set_bit(arg, cpubuf);
@@ -110,7 +110,7 @@ unsigned long *cpumask(char *s, int *ncp
 				set_bit(i, cpubuf);
 		}
 	} 
-	*ncpus = cpubufsize;
+	*bufsz = cpubufsize;
 	return cpubuf;	
 }
 


Index: numactl.spec
===================================================================
RCS file: /cvs/extras/rpms/numactl/devel/numactl.spec,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- numactl.spec	14 Mar 2008 11:38:31 -0000	1.50
+++ numactl.spec	25 Apr 2008 13:13:30 -0000	1.51
@@ -1,7 +1,7 @@
 Name:		numactl
 Summary:	Library for tuning for Non Uniform Memory Access machines
 Version:	1.0.2
-Release:	5%{dist} 
+Release:	6%{dist} 
 License:	LGPLv2/GPLv2
 Group: 		System Environment/Base
 URL: 		ftp://ftp.suse.com/pub/people/ak/numa/
@@ -11,6 +11,7 @@
 ExcludeArch: s390 s390x
 Patch0: numactl-1.0.2-get_mempolicy-const.patch
 Patch1: numactl-1.0.2-alpha-syscall.patch
+Patch2: numactl-1.0.2-cpumask.patch
 
 %description
 Simple NUMA policy support. It consists of a numactl program to run
@@ -29,6 +30,7 @@
 %setup -q 
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 make CFLAGS="$RPM_OPT_FLAGS -I. -fPIC"
@@ -70,6 +72,9 @@
 %{_mandir}/man3/*.3*
 
 %changelog
+* Fri Apr 25 2008 Neil Horman <nhorman at redhat.com> - 1.0.2-6
+- Fix buffer size passing and arg sanity check for physcpubind (bz 442521)
+
 * Fri Mar 14 2008 Neil Horman <nhorman at redhat.com> - 1.0.2-5
 - Fixing spec file to actually apply alpha patch :)
 




More information about the fedora-extras-commits mailing list