Skip to content

Commit be7a741

Browse files
Ken Millsgregkh
authored andcommitted
n_gsm: Fix message length handling when building header
Fix message length handling when building header When the message length is greater than 127, the length field in the header is built incorrectly. According to the spec, when the length is less than 128 the length field is a single byte formatted as: bbbbbbb1. When it is greater than 127 then the field is two bytes of the format: bbbbbbb0 bbbbbbbb. Signed-off-by: Ken Mills <[email protected]> Signed-off-by: Alan Cox <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent cf7d7e5 commit be7a741

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/tty/n_gsm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,8 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
716716
if (msg->len < 128)
717717
*--dp = (msg->len << 1) | EA;
718718
else {
719-
*--dp = ((msg->len & 127) << 1) | EA;
720-
*--dp = (msg->len >> 6) & 0xfe;
719+
*--dp = (msg->len >> 7); /* bits 7 - 15 */
720+
*--dp = (msg->len & 127) << 1; /* bits 0 - 6 */
721721
}
722722
}
723723

0 commit comments

Comments
 (0)