From owner-freebsd-bugs@FreeBSD.ORG Tue Nov 8 00:10:06 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B71D1065674 for ; Tue, 8 Nov 2011 00:10:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 78FDE8FC14 for ; Tue, 8 Nov 2011 00:10:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id pA80A6wC004634 for ; Tue, 8 Nov 2011 00:10:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id pA80A67L004633; Tue, 8 Nov 2011 00:10:06 GMT (envelope-from gnats) Resent-Date: Tue, 8 Nov 2011 00:10:06 GMT Resent-Message-Id: <201111080010.pA80A67L004633@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexander Best Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AC841065673 for ; Tue, 8 Nov 2011 00:02:53 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 0FE978FC14 for ; Tue, 8 Nov 2011 00:02:53 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pA802qwA069246 for ; Tue, 8 Nov 2011 00:02:52 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id pA802quv069245; Tue, 8 Nov 2011 00:02:52 GMT (envelope-from nobody) Message-Id: <201111080002.pA802quv069245@red.freebsd.org> Date: Tue, 8 Nov 2011 00:02:52 GMT From: Alexander Best To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/162366: [ath] several shifts overflowing in sys/dev/ath code X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2011 00:10:06 -0000 >Number: 162366 >Category: kern >Synopsis: [ath] several shifts overflowing in sys/dev/ath code >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Nov 08 00:10:06 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Alexander Best >Release: 10.0-CURRENT >Organization: >Environment: FreeBSD otaku 10.0-CURRENT FreeBSD 10.0-CURRENT #6: Fri Nov 4 14:33:13 CET 2011 arundel@otaku:/usr/obj/usr/git-freebsd-head/sys/ARUNDEL amd64 >Description: clang warns about several shift overflows in sys/dev/ath code: /usr/git-freebsd-head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c:36:3: warning: signed shift result (0x200000000) requires 35 bits to represent, but 'int' only has 32 bits [-Wshift-overflow] OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_ALLOW); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/git-freebsd-head/sys/dev/ath/ath_hal/ah_internal.h:471:42: note: expanded from macro 'OS_REG_RMW_FIELD' (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f))) ^ /usr/git-freebsd-head/sys/dev/ath/ah_osdep.h:127:49: note: expanded from macro 'OS_REG_WRITE' (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) ^~~~ /usr/git-freebsd-head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c:90:3: warning: signed shift result (0x100000000) requires 34 bits to represent, but 'int' only has 32 bits [-Wshift-overflow] OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_SLP); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/git-freebsd-head/sys/dev/ath/ath_hal/ah_internal.h:471:42: note: expanded from macro 'OS_REG_RMW_FIELD' (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f))) ^ /usr/git-freebsd-head/sys/dev/ath/ah_osdep.h:127:49: note: expanded from macro 'OS_REG_WRITE' (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) ^~~~ 2 warnings generated. /usr/git-freebsd-head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c:79:3: warning: signed shift result (0x100000000) requires 34 bits to represent, but 'int' only has 32 bits [-Wshift-overflow] OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_SLP); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/git-freebsd-head/sys/dev/ath/ath_hal/ah_internal.h:471:42: note: expanded from macro 'OS_REG_RMW_FIELD' (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f))) ^ /usr/git-freebsd-head/sys/dev/ath/ah_osdep.h:127:49: note: expanded from macro 'OS_REG_WRITE' (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) ^~~~ /usr/git-freebsd-head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c:92:3: warning: signed shift result (0x200000000) requires 35 bits to represent, but 'int' only has 32 bits [-Wshift-overflow] OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_NORM); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/git-freebsd-head/sys/dev/ath/ath_hal/ah_internal.h:471:42: note: expanded from macro 'OS_REG_RMW_FIELD' (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f))) ^ /usr/git-freebsd-head/sys/dev/ath/ah_osdep.h:127:49: note: expanded from macro 'OS_REG_WRITE' (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) ^~~~ 2 warnings generated. dimitry andric explained in [1] that at least the first case appears to be a real bug and not a bogus compiler warning. the other cases need to be investigated in detail, too. [1] http://lists.freebsd.org/pipermail/freebsd-toolchain/2011-November/000282.html >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: