All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE
@ 2017-08-21  2:40 Tom Rini
  2017-08-21  2:40 ` [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data Tom Rini
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tom Rini @ 2017-08-21  2:40 UTC (permalink / raw)
  To: u-boot

In the general case, CONFIG_NFS_READ_SIZE is unchanged from the default
of 1024.  There are in fact no in-tree users that increase this size.
Adjust the comment to reflect what could be done in the future in
conjunction with CONFIG_IP_DEFRAG.

Cc: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 net/nfs.h | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/net/nfs.h b/net/nfs.h
index 70a1a6d554be..1aa06e8fb90f 100644
--- a/net/nfs.h
+++ b/net/nfs.h
@@ -36,16 +36,13 @@
 #define NFSERR_ISDIR    21
 #define NFSERR_INVAL    22
 
-/* Block size used for NFS read accesses.  A RPC reply packet (including  all
+/*
+ * Block size used for NFS read accesses.  A RPC reply packet (including  all
  * headers) must fit within a single Ethernet frame to avoid fragmentation.
- * However, if CONFIG_IP_DEFRAG is set, the config file may want to use a
- * bigger value. In any case, most NFS servers are optimized for a power of 2.
+ * However, if CONFIG_IP_DEFRAG is set, a bigger value could be used.  In any
+ * case, most NFS servers are optimized for a power of 2.
  */
-#ifdef CONFIG_NFS_READ_SIZE
-#define NFS_READ_SIZE CONFIG_NFS_READ_SIZE
-#else
-#define NFS_READ_SIZE 1024 /* biggest power of two that fits Ether frame */
-#endif
+#define NFS_READ_SIZE	1024	/* biggest power of two that fits Ether frame */
 
 /* Values for Accept State flag on RPC answers (See: rfc1831) */
 enum rpc_accept_stat {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data
  2017-08-21  2:40 [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE Tom Rini
@ 2017-08-21  2:40 ` Tom Rini
  2017-08-22 19:02   ` Joe Hershberger
                     ` (2 more replies)
  2017-08-22 19:01 ` [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE Joe Hershberger
  2017-09-07 18:32 ` [U-Boot] " Joe Hershberger
  2 siblings, 3 replies; 7+ messages in thread
From: Tom Rini @ 2017-08-21  2:40 UTC (permalink / raw)
  To: u-boot

In rpc_t we declare data to be a uint8_t of size 2048, for a final size
of 2048.  We also however declare the reply part of the union to have a
uint32_t data field of NFS_READ_SIZE (1024) for a final size of
4096+24=4120 and an overrun.  Expand the comment above the struct to
note that if NFS_READ_SIZE is increased then the data buf must also be
increased and correct the declaration to be uint8_t.

Reported-by: Coverity (CID: 152888)
Cc: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 net/nfs.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/nfs.h b/net/nfs.h
index 1aa06e8fb90f..b23b4088d825 100644
--- a/net/nfs.h
+++ b/net/nfs.h
@@ -39,8 +39,9 @@
 /*
  * Block size used for NFS read accesses.  A RPC reply packet (including  all
  * headers) must fit within a single Ethernet frame to avoid fragmentation.
- * However, if CONFIG_IP_DEFRAG is set, a bigger value could be used.  In any
- * case, most NFS servers are optimized for a power of 2.
+ * However, if CONFIG_IP_DEFRAG is set, a bigger value could be used, so long
+ * as rpc_t->u->data is incrased to match. In any case, most NFS servers are
+ * optimized for a power of 2.
  */
 #define NFS_READ_SIZE	1024	/* biggest power of two that fits Ether frame */
 
@@ -73,7 +74,7 @@ struct rpc_t {
 			uint32_t verifier;
 			uint32_t v2;
 			uint32_t astatus;
-			uint32_t data[NFS_READ_SIZE];
+			uint8_t data[NFS_READ_SIZE];
 		} reply;
 	} u;
 } __attribute__((packed));
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE
  2017-08-21  2:40 [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE Tom Rini
  2017-08-21  2:40 ` [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data Tom Rini
@ 2017-08-22 19:01 ` Joe Hershberger
  2017-09-07 18:32 ` [U-Boot] " Joe Hershberger
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2017-08-22 19:01 UTC (permalink / raw)
  To: u-boot

On Sun, Aug 20, 2017 at 9:40 PM, Tom Rini <trini@konsulko.com> wrote:
> In the general case, CONFIG_NFS_READ_SIZE is unchanged from the default
> of 1024.  There are in fact no in-tree users that increase this size.
> Adjust the comment to reflect what could be done in the future in
> conjunction with CONFIG_IP_DEFRAG.
>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data
  2017-08-21  2:40 ` [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data Tom Rini
@ 2017-08-22 19:02   ` Joe Hershberger
  2017-08-29 15:00   ` Joe Hershberger
  2017-08-29 18:55   ` Joe Hershberger
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2017-08-22 19:02 UTC (permalink / raw)
  To: u-boot

On Sun, Aug 20, 2017 at 9:40 PM, Tom Rini <trini@konsulko.com> wrote:
> In rpc_t we declare data to be a uint8_t of size 2048, for a final size
> of 2048.  We also however declare the reply part of the union to have a
> uint32_t data field of NFS_READ_SIZE (1024) for a final size of
> 4096+24=4120 and an overrun.  Expand the comment above the struct to
> note that if NFS_READ_SIZE is increased then the data buf must also be
> increased and correct the declaration to be uint8_t.
>
> Reported-by: Coverity (CID: 152888)
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data
  2017-08-21  2:40 ` [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data Tom Rini
  2017-08-22 19:02   ` Joe Hershberger
@ 2017-08-29 15:00   ` Joe Hershberger
  2017-08-29 18:55   ` Joe Hershberger
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2017-08-29 15:00 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On Sun, Aug 20, 2017 at 9:40 PM, Tom Rini <trini@konsulko.com> wrote:
> In rpc_t we declare data to be a uint8_t of size 2048, for a final size
> of 2048.  We also however declare the reply part of the union to have a
> uint32_t data field of NFS_READ_SIZE (1024) for a final size of
> 4096+24=4120 and an overrun.  Expand the comment above the struct to
> note that if NFS_READ_SIZE is increased then the data buf must also be
> increased and correct the declaration to be uint8_t.
>
> Reported-by: Coverity (CID: 152888)
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>

This seems to be breaking one of the targets...
https://travis-ci.org/jhershbe/u-boot/jobs/269330530

Thanks,
-Joe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data
  2017-08-21  2:40 ` [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data Tom Rini
  2017-08-22 19:02   ` Joe Hershberger
  2017-08-29 15:00   ` Joe Hershberger
@ 2017-08-29 18:55   ` Joe Hershberger
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2017-08-29 18:55 UTC (permalink / raw)
  To: u-boot

On Sun, Aug 20, 2017 at 9:40 PM, Tom Rini <trini@konsulko.com> wrote:
> In rpc_t we declare data to be a uint8_t of size 2048, for a final size
> of 2048.  We also however declare the reply part of the union to have a
> uint32_t data field of NFS_READ_SIZE (1024) for a final size of
> 4096+24=4120 and an overrun.  Expand the comment above the struct to
> note that if NFS_READ_SIZE is increased then the data buf must also be
> increased and correct the declaration to be uint8_t.
>
> Reported-by: Coverity (CID: 152888)
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  net/nfs.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/nfs.h b/net/nfs.h
> index 1aa06e8fb90f..b23b4088d825 100644
> --- a/net/nfs.h
> +++ b/net/nfs.h
> @@ -39,8 +39,9 @@
>  /*
>   * Block size used for NFS read accesses.  A RPC reply packet (including  all
>   * headers) must fit within a single Ethernet frame to avoid fragmentation.
> - * However, if CONFIG_IP_DEFRAG is set, a bigger value could be used.  In any
> - * case, most NFS servers are optimized for a power of 2.
> + * However, if CONFIG_IP_DEFRAG is set, a bigger value could be used, so long
> + * as rpc_t->u->data is incrased to match. In any case, most NFS servers are
> + * optimized for a power of 2.
>   */
>  #define NFS_READ_SIZE  1024    /* biggest power of two that fits Ether frame */
>
> @@ -73,7 +74,7 @@ struct rpc_t {
>                         uint32_t verifier;
>                         uint32_t v2;
>                         uint32_t astatus;
> -                       uint32_t data[NFS_READ_SIZE];
> +                       uint8_t data[NFS_READ_SIZE];

All of the pointer math would also need to be updated. Didn't notice
that at first so,

Nacked-by: Joe Hershberger <joe.hershberger@ni.com>

>                 } reply;
>         } u;
>  } __attribute__((packed));
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] net: nfs: Drop CONFIG_NFS_READ_SIZE
  2017-08-21  2:40 [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE Tom Rini
  2017-08-21  2:40 ` [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data Tom Rini
  2017-08-22 19:01 ` [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE Joe Hershberger
@ 2017-09-07 18:32 ` Joe Hershberger
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2017-09-07 18:32 UTC (permalink / raw)
  To: u-boot

Hi Tom,

https://patchwork.ozlabs.org/patch/803831/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-09-07 18:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-21  2:40 [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE Tom Rini
2017-08-21  2:40 ` [U-Boot] [PATCH 2/2] net: nfs: Correct type of rpc_t->u.reply->data Tom Rini
2017-08-22 19:02   ` Joe Hershberger
2017-08-29 15:00   ` Joe Hershberger
2017-08-29 18:55   ` Joe Hershberger
2017-08-22 19:01 ` [U-Boot] [PATCH 1/2] net: nfs: Drop CONFIG_NFS_READ_SIZE Joe Hershberger
2017-09-07 18:32 ` [U-Boot] " Joe Hershberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.