瀏覽代碼

[crypto] Add parentheses around len argument in blocksize assert

This fixes an issue where passing a length as a compound expression
(e.g. using `hdrlen + datalen') would trigger compiler warnings and
potentially precedence-related errors.

Signed-off-by: Marty Connor <mdc@etherboot.org>
tags/v1.0.0-rc1
Joshua Oreman 15 年之前
父節點
當前提交
ff4d61de96
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      src/include/gpxe/crypto.h

+ 2
- 2
src/include/gpxe/crypto.h 查看文件

@@ -129,7 +129,7 @@ static inline void cipher_encrypt ( struct cipher_algorithm *cipher,
129 129
 	cipher->encrypt ( ctx, src, dst, len );
130 130
 }
131 131
 #define cipher_encrypt( cipher, ctx, src, dst, len ) do {		\
132
-	assert ( ( len & ( (cipher)->blocksize - 1 ) ) == 0 );		\
132
+	assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 );	\
133 133
 	cipher_encrypt ( (cipher), (ctx), (src), (dst), (len) );	\
134 134
 	} while ( 0 )
135 135
 
@@ -139,7 +139,7 @@ static inline void cipher_decrypt ( struct cipher_algorithm *cipher,
139 139
 	cipher->decrypt ( ctx, src, dst, len );
140 140
 }
141 141
 #define cipher_decrypt( cipher, ctx, src, dst, len ) do {		\
142
-	assert ( ( len & ( (cipher)->blocksize - 1 ) ) == 0 );		\
142
+	assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 );	\
143 143
 	cipher_decrypt ( (cipher), (ctx), (src), (dst), (len) );	\
144 144
 	} while ( 0 )
145 145
 

Loading…
取消
儲存