From patchwork Wed Jun 26 15:07:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "John W. Linville" X-Patchwork-Id: 2786291 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5A077C0AB1 for ; Wed, 26 Jun 2013 15:15:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8168204C0 for ; Wed, 26 Jun 2013 15:15:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E971020439 for ; Wed, 26 Jun 2013 15:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751645Ab3FZPPN (ORCPT ); Wed, 26 Jun 2013 11:15:13 -0400 Received: from charlotte.tuxdriver.com ([70.61.120.58]:41135 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349Ab3FZPPM (ORCPT ); Wed, 26 Jun 2013 11:15:12 -0400 Received: from uucp by smtp.tuxdriver.com with local-rmail (Exim 4.63) (envelope-from ) id 1UrrR6-0007Ha-Ss; Wed, 26 Jun 2013 11:15:10 -0400 Received: from linville-x1.hq.tuxdriver.com (localhost.localdomain [127.0.0.1]) by linville-x1.hq.tuxdriver.com (8.14.7/8.14.6) with ESMTP id r5QF7gCn007097; Wed, 26 Jun 2013 11:07:43 -0400 Received: (from linville@localhost) by linville-x1.hq.tuxdriver.com (8.14.7/8.14.7/Submit) id r5QF7gAv007096; Wed, 26 Jun 2013 11:07:42 -0400 From: "John W. Linville" To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, "John W. Linville" Subject: [PATCH] iw: fix incorrect bit shifting in print_ht_mcs Date: Wed, 26 Jun 2013 11:07:40 -0400 Message-Id: <1372259260-7061-1-git-send-email-linville@tuxdriver.com> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "John W. Linville" From a Coverity run on version 3.10: iw-3.10/util.c:569:result_independent_of_operands – "mcs[10] >> 8" is 0 regardless of the values of its operands. This occurs as the bitwise first operand of '&'. This seems more like what was intended... Signed-off-by: John W. Linville --- util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.c b/util.c index d8b76ee..e3d0c27 100644 --- a/util.c +++ b/util.c @@ -574,7 +574,7 @@ void print_ht_mcs(const __u8 *mcs) unsigned int tx_max_num_spatial_streams, max_rx_supp_data_rate; bool tx_mcs_set_defined, tx_mcs_set_equal, tx_unequal_modulation; - max_rx_supp_data_rate = ((mcs[10] >> 8) & ((mcs[11] & 0x3) << 8)); + max_rx_supp_data_rate = (mcs[10] & ((mcs[11] & 0x3) << 8)); tx_mcs_set_defined = !!(mcs[12] & (1 << 0)); tx_mcs_set_equal = !(mcs[12] & (1 << 1)); tx_max_num_spatial_streams = ((mcs[12] >> 2) & 3) + 1;