File tree 1 file changed +2
-4
lines changed
1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ struct sem_undo {
152
152
struct list_head list_id ; /* per semaphore array list:
153
153
* all undos for one array */
154
154
int semid ; /* semaphore set identifier */
155
- short * semadj ; /* array of adjustments */
155
+ short semadj [] ; /* array of adjustments */
156
156
/* one per semaphore */
157
157
};
158
158
@@ -1938,8 +1938,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
1938
1938
rcu_read_unlock ();
1939
1939
1940
1940
/* step 2: allocate new undo structure */
1941
- new = kvzalloc (sizeof (struct sem_undo ) + sizeof (short )* nsems ,
1942
- GFP_KERNEL_ACCOUNT );
1941
+ new = kvzalloc (struct_size (new , semadj , nsems ), GFP_KERNEL_ACCOUNT );
1943
1942
if (!new ) {
1944
1943
ipc_rcu_putref (& sma -> sem_perm , sem_rcu_free );
1945
1944
return ERR_PTR (- ENOMEM );
@@ -1967,7 +1966,6 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
1967
1966
goto success ;
1968
1967
}
1969
1968
/* step 5: initialize & link new undo structure */
1970
- new -> semadj = (short * ) & new [1 ];
1971
1969
new -> ulp = ulp ;
1972
1970
new -> semid = semid ;
1973
1971
assert_spin_locked (& ulp -> lock );
You can’t perform that action at this time.
0 commit comments