diff options
Diffstat (limited to 'ipc/sem.c')
-rw-r--r-- | ipc/sem.c | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -176,13 +176,17 @@ void __init sem_init (void) | |||
176 | 176 | ||
177 | static inline struct sem_array *sem_lock(struct ipc_namespace *ns, int id) | 177 | static inline struct sem_array *sem_lock(struct ipc_namespace *ns, int id) |
178 | { | 178 | { |
179 | return (struct sem_array *) ipc_lock(&sem_ids(ns), id); | 179 | struct kern_ipc_perm *ipcp = ipc_lock(&sem_ids(ns), id); |
180 | |||
181 | return container_of(ipcp, struct sem_array, sem_perm); | ||
180 | } | 182 | } |
181 | 183 | ||
182 | static inline struct sem_array *sem_lock_check(struct ipc_namespace *ns, | 184 | static inline struct sem_array *sem_lock_check(struct ipc_namespace *ns, |
183 | int id) | 185 | int id) |
184 | { | 186 | { |
185 | return (struct sem_array *) ipc_lock_check(&sem_ids(ns), id); | 187 | struct kern_ipc_perm *ipcp = ipc_lock_check(&sem_ids(ns), id); |
188 | |||
189 | return container_of(ipcp, struct sem_array, sem_perm); | ||
186 | } | 190 | } |
187 | 191 | ||
188 | static inline void sem_rmid(struct ipc_namespace *ns, struct sem_array *s) | 192 | static inline void sem_rmid(struct ipc_namespace *ns, struct sem_array *s) |
@@ -277,14 +281,21 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params) | |||
277 | } | 281 | } |
278 | 282 | ||
279 | 283 | ||
280 | static inline int sem_security(void *sma, int semflg) | 284 | static inline int sem_security(struct kern_ipc_perm *ipcp, int semflg) |
281 | { | 285 | { |
282 | return security_sem_associate((struct sem_array *) sma, semflg); | 286 | struct sem_array *sma; |
287 | |||
288 | sma = container_of(ipcp, struct sem_array, sem_perm); | ||
289 | return security_sem_associate(sma, semflg); | ||
283 | } | 290 | } |
284 | 291 | ||
285 | static inline int sem_more_checks(void *sma, struct ipc_params *params) | 292 | static inline int sem_more_checks(struct kern_ipc_perm *ipcp, |
293 | struct ipc_params *params) | ||
286 | { | 294 | { |
287 | if (params->u.nsems > ((struct sem_array *)sma)->sem_nsems) | 295 | struct sem_array *sma; |
296 | |||
297 | sma = container_of(ipcp, struct sem_array, sem_perm); | ||
298 | if (params->u.nsems > sma->sem_nsems) | ||
288 | return -EINVAL; | 299 | return -EINVAL; |
289 | 300 | ||
290 | return 0; | 301 | return 0; |