summaryrefslogtreecommitdiffstats
path: root/ncr-limits.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-05-28 16:05:58 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-06-17 20:47:38 +0200
commitd3c211c2e46125ea98a45f2dad9af4669c347fa6 (patch)
treecffed929cfb1f6fe9b0c9f41d5fa2130571f123b /ncr-limits.c
parentc3695ab5f06af533deaf1de75cdd4631a9d77d00 (diff)
downloadkernel-crypto-d3c211c2e46125ea98a45f2dad9af4669c347fa6.tar.gz
kernel-crypto-d3c211c2e46125ea98a45f2dad9af4669c347fa6.tar.xz
kernel-crypto-d3c211c2e46125ea98a45f2dad9af4669c347fa6.zip
Compilation and initialization fixes.
Diffstat (limited to 'ncr-limits.c')
-rw-r--r--ncr-limits.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ncr-limits.c b/ncr-limits.c
index c65b7b333d7..df6be74ca5b 100644
--- a/ncr-limits.c
+++ b/ncr-limits.c
@@ -26,6 +26,8 @@
#include "cryptodev.h"
#include <asm/atomic.h>
#include <linux/version.h>
+#include <linux/file.h>
+#include <linux/cred.h>
#include "ncr.h"
#include "ncr_int.h"
@@ -57,7 +59,9 @@ struct limit_process_item_st {
struct limit_st {
struct list_sem_st users;
struct list_sem_st processes;
-} limits;
+};
+
+static struct limit_st limits;
void ncr_limits_init(void)
{
@@ -87,6 +91,7 @@ int add = 1;
list_for_each_entry(uitem, &limits.users.list, list) {
if (uitem->uid == uid && uitem->type == type) {
add = 0;
+printk("user: %d max: %d, count: %d\n", (int)uid, max_per_user[type], atomic_read(&uitem->cnt));
if (atomic_add_unless(&uitem->cnt, 1, max_per_user[type])==0) {
err();
up(&limits.users.sem);
@@ -96,7 +101,7 @@ int add = 1;
}
if (add) {
- uitem = kmalloc(GFP_KERNEL, sizeof(*uitem));
+ uitem = kmalloc( sizeof(*uitem), GFP_KERNEL);
if (uitem == NULL) {
err();
return -ENOMEM;
@@ -125,7 +130,7 @@ int add = 1;
if (add) {
- pitem = kmalloc(GFP_KERNEL, sizeof(*pitem));
+ pitem = kmalloc(sizeof(*pitem), GFP_KERNEL);
if (uitem == NULL) {
err();
return -ENOMEM;