On 2/11/2017 5:36 AM, yuan linyu wrote:

From: yuan linyu <linyu.y...@alcatel-sbell.com.cn>

'max' only used at three places in scm.c,
1. in scm_fp_copy(), fpl->max = SCM_MAX_FD;
2. in scm_fp_copy(), if (fpl->count + num > fpl->max)
3. in scm_fp_dup(), new_fpl->max = new_fpl->count;
at place 2, fpl->max can be replaced with SCM_MAX_FD.
no other place read this 'max' again, so it can be removed.

Signed-off-by: yuan linyu <linyu.y...@alcatel-sbell.com.cn>
---
v1->v2:
    update commit log to describe correct reason to remove 'max'

 include/net/scm.h |  3 +--
 net/core/scm.c    | 20 +++++---------------
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/include/net/scm.h b/include/net/scm.h
index 59fa93c..1301227 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -19,8 +19,7 @@ struct scm_creds {
 };

 struct scm_fp_list {
-       short                   count;
-       short                   max;
+       unsigned int    count;

   Why break the alignment in the 2nd column?

        struct user_struct      *user;
        struct file             *fp[SCM_MAX_FD];
 };
[...]

MBR, Sergei

Reply via email to