@@ -817,7 +817,6 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
817817 "assemble SMB2_PREAUTH_INTEGRITY_CAPABILITIES context\n" );
818818 build_preauth_ctxt ((struct smb2_preauth_neg_context * )pneg_ctxt ,
819819 conn -> preauth_info -> Preauth_HashId );
820- rsp -> NegotiateContextCount = cpu_to_le16 (neg_ctxt_cnt );
821820 inc_rfc1001_len (smb2_buf_len , AUTH_GSS_PADDING );
822821 ctxt_size = sizeof (struct smb2_preauth_neg_context );
823822 /* Round to 8 byte boundary */
@@ -829,7 +828,7 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
829828 "assemble SMB2_ENCRYPTION_CAPABILITIES context\n" );
830829 build_encrypt_ctxt ((struct smb2_encryption_neg_context * )pneg_ctxt ,
831830 conn -> cipher_type );
832- rsp -> NegotiateContextCount = cpu_to_le16 ( ++ neg_ctxt_cnt ) ;
831+ neg_ctxt_cnt ++ ;
833832 ctxt_size += sizeof (struct smb2_encryption_neg_context ) + 2 ;
834833 /* Round to 8 byte boundary */
835834 pneg_ctxt +=
@@ -844,7 +843,7 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
844843 /* Temporarily set to SMB3_COMPRESS_NONE */
845844 build_compression_ctxt ((struct smb2_compression_capabilities_context * )pneg_ctxt ,
846845 conn -> compress_algorithm );
847- rsp -> NegotiateContextCount = cpu_to_le16 ( ++ neg_ctxt_cnt ) ;
846+ neg_ctxt_cnt ++ ;
848847 ctxt_size += sizeof (struct smb2_compression_capabilities_context ) + 2 ;
849848 /* Round to 8 byte boundary */
850849 pneg_ctxt += round_up (sizeof (struct smb2_compression_capabilities_context ) + 2 ,
@@ -856,7 +855,7 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
856855 ksmbd_debug (SMB ,
857856 "assemble SMB2_POSIX_EXTENSIONS_AVAILABLE context\n" );
858857 build_posix_ctxt ((struct smb2_posix_neg_context * )pneg_ctxt );
859- rsp -> NegotiateContextCount = cpu_to_le16 ( ++ neg_ctxt_cnt ) ;
858+ neg_ctxt_cnt ++ ;
860859 ctxt_size += sizeof (struct smb2_posix_neg_context );
861860 /* Round to 8 byte boundary */
862861 pneg_ctxt += round_up (sizeof (struct smb2_posix_neg_context ), 8 );
@@ -868,10 +867,11 @@ static void assemble_neg_contexts(struct ksmbd_conn *conn,
868867 "assemble SMB2_SIGNING_CAPABILITIES context\n" );
869868 build_sign_cap_ctxt ((struct smb2_signing_capabilities * )pneg_ctxt ,
870869 conn -> signing_algorithm );
871- rsp -> NegotiateContextCount = cpu_to_le16 ( ++ neg_ctxt_cnt ) ;
870+ neg_ctxt_cnt ++ ;
872871 ctxt_size += sizeof (struct smb2_signing_capabilities ) + 2 ;
873872 }
874873
874+ rsp -> NegotiateContextCount = cpu_to_le16 (neg_ctxt_cnt );
875875 inc_rfc1001_len (smb2_buf_len , ctxt_size );
876876}
877877
0 commit comments