uml: fix build error due to frame size > 1024
the UML build fails during the kernel build: | arch/um/drivers/net_kern.c: In function 'compute_hash': | arch/um/drivers/net_kern.c:322:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] | 322 | } | | ^ |cc1: all warnings being treated as errors The compute_hash() function is added by our patch: 102-pseudo-random-mac.patch Instead of allocating a 1024 byte buffer on the stack for the SHA1 digest input, let's allocate the data on the heap. We should be able to do that since crypto_alloc_ahash and ahash_request_alloc also need to allocate structures on the heap. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
This commit is contained in:
parent
7d0fb2cc34
commit
aed2569d37
@ -49,7 +49,7 @@ Applies to vanilla kernel 3.9.4.
|
|||||||
#define DRIVER_NAME "uml-netdev"
|
#define DRIVER_NAME "uml-netdev"
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(opened_lock);
|
static DEFINE_SPINLOCK(opened_lock);
|
||||||
@@ -274,9 +282,51 @@ static const struct ethtool_ops uml_net_
|
@@ -274,9 +282,55 @@ static const struct ethtool_ops uml_net_
|
||||||
.get_ts_info = ethtool_op_get_ts_info,
|
.get_ts_info = ethtool_op_get_ts_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,24 +59,26 @@ Applies to vanilla kernel 3.9.4.
|
|||||||
+ * * an interface name. */
|
+ * * an interface name. */
|
||||||
+static int compute_hash(const char *umid, const char *ifname, char *hash)
|
+static int compute_hash(const char *umid, const char *ifname, char *hash)
|
||||||
+{
|
+{
|
||||||
+ struct ahash_request *desc;
|
+ struct ahash_request *desc = NULL;
|
||||||
+ struct crypto_ahash *tfm;
|
+ struct crypto_ahash *tfm = NULL;
|
||||||
+ struct scatterlist sg;
|
+ struct scatterlist sg;
|
||||||
+ char vmif[1024];
|
+ char *vmif = NULL;
|
||||||
+ int ret;
|
+ int ret = -ENOMEM;
|
||||||
|
+
|
||||||
|
+ vmif = kmalloc(1024, GFP_KERNEL);
|
||||||
|
+ if (!vmif)
|
||||||
|
+ goto out;
|
||||||
+
|
+
|
||||||
+ strcpy (vmif, umid);
|
+ strcpy (vmif, umid);
|
||||||
+ strcat (vmif, ifname);
|
+ strcat (vmif, ifname);
|
||||||
+
|
+
|
||||||
+ tfm = crypto_alloc_ahash("sha1", 0, CRYPTO_ALG_ASYNC);
|
+ tfm = crypto_alloc_ahash("sha1", 0, CRYPTO_ALG_ASYNC);
|
||||||
+ if (IS_ERR(tfm))
|
+ if (IS_ERR(tfm))
|
||||||
+ return -ENOMEM;
|
+ goto out;
|
||||||
+
|
+
|
||||||
+ desc = ahash_request_alloc(tfm, GFP_KERNEL);
|
+ desc = ahash_request_alloc(tfm, GFP_KERNEL);
|
||||||
+ if (!desc) {
|
+ if (!desc)
|
||||||
+ ret = -ENOMEM;
|
|
||||||
+ goto out;
|
+ goto out;
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ crypto_ahash_clear_flags(tfm, ~0);
|
+ crypto_ahash_clear_flags(tfm, ~0);
|
||||||
+
|
+
|
||||||
@ -88,6 +90,8 @@ Applies to vanilla kernel 3.9.4.
|
|||||||
+ ret = crypto_ahash_digest(desc);
|
+ ret = crypto_ahash_digest(desc);
|
||||||
+out:
|
+out:
|
||||||
+ crypto_free_ahash(tfm);
|
+ crypto_free_ahash(tfm);
|
||||||
|
+ ahash_request_free(desc);
|
||||||
|
+ kfree(vmif);
|
||||||
+
|
+
|
||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
@ -101,7 +105,7 @@ Applies to vanilla kernel 3.9.4.
|
|||||||
char *end;
|
char *end;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -319,9 +369,26 @@ void uml_net_setup_etheraddr(struct net_
|
@@ -319,9 +373,26 @@ void uml_net_setup_etheraddr(struct net_
|
||||||
return;
|
return;
|
||||||
|
|
||||||
random:
|
random:
|
||||||
|
Loading…
Reference in New Issue
Block a user