Skip to content

Commit 2ab399a

Browse files
lxindavem330
authored andcommitted
sctp: delete the nested flexible array hmac
This patch deletes the flexible-array hmac[] from the structure sctp_authhdr to avoid some sparse warnings: # make C=2 CF="-Wflexible-array-nested" M=./net/sctp/ net/sctp/auth.c: note: in included file (through include/net/sctp/structs.h, include/net/sctp/sctp.h): ./include/linux/sctp.h:735:29: warning: nested flexible array Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f97278f commit 2ab399a

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

include/linux/sctp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ struct sctp_addip_chunk {
727727
struct sctp_authhdr {
728728
__be16 shkey_id;
729729
__be16 hmac_id;
730-
__u8 hmac[];
730+
/* __u8 hmac[]; */
731731
};
732732

733733
struct sctp_auth_chunk {

net/sctp/auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
738738

739739
tfm = asoc->ep->auth_hmacs[hmac_id];
740740

741-
digest = auth->auth_hdr.hmac;
741+
digest = (u8 *)(&auth->auth_hdr + 1);
742742
if (crypto_shash_setkey(tfm, &asoc_key->data[0], asoc_key->len))
743743
goto free;
744744

net/sctp/sm_statefuns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4391,7 +4391,7 @@ static enum sctp_ierror sctp_sf_authenticate(
43914391
* 3. Compute the new digest
43924392
* 4. Compare saved and new digests.
43934393
*/
4394-
digest = auth_hdr->hmac;
4394+
digest = (u8 *)(auth_hdr + 1);
43954395
skb_pull(chunk->skb, sig_len);
43964396

43974397
save_digest = kmemdup(digest, sig_len, GFP_ATOMIC);

0 commit comments

Comments
 (0)