diff options
author | Enzo Matsumiya <ematsumiya@suse.de> | 2022-10-13 05:53:09 +0200 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2022-10-13 16:36:39 +0200 |
commit | d7173623bf0b1503bc4e6f13cd0fccab5e98c6ce (patch) | |
tree | c5a1df48298e7e9b31ef8faa5de508cc94e44a8c /fs/cifs/smb2misc.c | |
parent | cifs: find and use the dentry for cached non-root directories also (diff) | |
download | linux-d7173623bf0b1503bc4e6f13cd0fccab5e98c6ce.tar.xz linux-d7173623bf0b1503bc4e6f13cd0fccab5e98c6ce.zip |
cifs: use ALIGN() and round_up() macros
Improve code readability by using existing macros:
Replace hardcoded alignment computations (e.g. (len + 7) & ~0x7) by
ALIGN()/IS_ALIGNED() macros.
Also replace (DIV_ROUND_UP(len, 8) * 8) with ALIGN(len, 8), which, if
not optimized by the compiler, has the overhead of a multiplication
and a division. Do the same for roundup() by replacing it by round_up()
(division-less version, but requires the multiple to be a power of 2,
which is always the case for us).
And remove some unnecessary checks where !IS_ALIGNED() would fit, but
calling round_up() directly is fine as it's a no-op if the value is
already aligned.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2misc.c')
-rw-r--r-- | fs/cifs/smb2misc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index 7db5c09ecceb..a38720477966 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c @@ -248,7 +248,7 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *server) * Some windows servers (win2016) will pad also the final * PDU in a compound to 8 bytes. */ - if (((calc_len + 7) & ~7) == len) + if (ALIGN(calc_len, 8) == len) return 0; /* |