Re: [bpf-next V5 PATCH 11/15] page_pool: refurbish version of page_pool code
From: Eric Dumazet <hidden>
Date: 2018-03-23 13:28:15
From: Eric Dumazet <hidden>
Date: 2018-03-23 13:28:15
On 03/23/2018 05:18 AM, Jesper Dangaard Brouer wrote:
+
+ /* Note, below struct compat code was primarily needed when
+ * page_pool code lived under MM-tree control, given mmots and
+ * net-next trees progress in very different rates.
+ *
+ * Allow kernel devel trees and driver to progress at different rates
+ */
+ param_copy_sz = PAGE_POOL_PARAMS_SIZE;
+ memset(&pool->p, 0, param_copy_sz);
+ if (params->size < param_copy_sz) {
+ /* Older module calling newer kernel, handled by only
+ * copying supplied size, and keep remaining params zero
+ */
+ param_copy_sz = params->size;
+ } else if (params->size > param_copy_sz) {
+ /* Newer module calling older kernel. Need to validate
+ * no new features were requested.
+ */
+ unsigned char *addr = (unsigned char *)params + param_copy_sz;
+ unsigned char *end = (unsigned char *)params + params->size;
+
+ for (; addr < end; addr++) {
+ if (*addr != 0)
+ return -E2BIG;
+ }
+ }I do not see the need for this part.