summaryrefslogtreecommitdiffstats
path: root/ncr-key-wrap.c
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-07-09 09:41:13 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-19 09:26:26 +0200
commitef0a304388b3d17a7730f04aa58aef5f94fcbf35 (patch)
tree547f375b22da76fcce879587a1b064b9eca01ded /ncr-key-wrap.c
parent8bc83c103fc3ac26ebadbe4fda33f4f72bd6b998 (diff)
downloadcryptodev-linux-ef0a304388b3d17a7730f04aa58aef5f94fcbf35.tar.gz
cryptodev-linux-ef0a304388b3d17a7730f04aa58aef5f94fcbf35.tar.xz
cryptodev-linux-ef0a304388b3d17a7730f04aa58aef5f94fcbf35.zip
Fix copy_{from,to}_user error handling
These functions return a positive number, not an error code, on failure. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'ncr-key-wrap.c')
-rw-r--r--ncr-key-wrap.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/ncr-key-wrap.c b/ncr-key-wrap.c
index b43aac2..cec850e 100644
--- a/ncr-key-wrap.c
+++ b/ncr-key-wrap.c
@@ -422,10 +422,9 @@ struct key_item_st* key = NULL;
struct data_item_st * data = NULL;
int ret;
- ret = copy_from_user( &wrap, arg, sizeof(wrap));
- if (unlikely(ret)) {
+ if (unlikely(copy_from_user(&wrap, arg, sizeof(wrap)))) {
err();
- return ret;
+ return -EFAULT;
}
ret = ncr_key_item_get_read( &wkey, key_lst, wrap.keytowrap);
@@ -486,10 +485,9 @@ struct key_item_st* key = NULL;
struct data_item_st * data = NULL;
int ret;
- ret = copy_from_user( &wrap, arg, sizeof(wrap));
- if (unlikely(ret)) {
+ if (unlikely(copy_from_user(&wrap, arg, sizeof(wrap)))) {
err();
- return ret;
+ return -EFAULT;
}
ret = ncr_key_item_get_write( &wkey, key_lst, wrap.keytowrap);
@@ -547,10 +545,9 @@ int ret;
return ENOKEY;
}
- ret = copy_from_user( &wrap, arg, sizeof(wrap));
- if (unlikely(ret)) {
+ if (unlikely(copy_from_user(&wrap, arg, sizeof(wrap)))) {
err();
- return ret;
+ return -EFAULT;
}
ret = ncr_key_item_get_read( &wkey, key_lst, wrap.keytowrap);
@@ -607,10 +604,9 @@ int ret;
return ENOKEY;
}
- ret = copy_from_user( &wrap, arg, sizeof(wrap));
- if (unlikely(ret)) {
+ if (unlikely(copy_from_user(&wrap, arg, sizeof(wrap)))) {
err();
- return ret;
+ return -EFAULT;
}
ret = ncr_key_item_get_write( &wkey, key_lst, wrap.keytowrap);