Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1126151imc; Mon, 11 Mar 2019 07:04:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPcj7rVtaL/EKZgaTIenfgrHtS3kR5m5EuisVJsr7z5qA/Z/c4eO7KPA0Sh+EFLAQvRYw/ X-Received: by 2002:a65:5c4b:: with SMTP id v11mr29754330pgr.411.1552313076554; Mon, 11 Mar 2019 07:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552313076; cv=none; d=google.com; s=arc-20160816; b=Od2Xi1BNzAkNn17j2bcJ/TS7KIMh8B7h4/g0d+V5yEFQ/MPGHNhPmN8joWiPQBR7S2 Nhhnbw5F3wC8Rtb+6PaVezF2KEEf1pbJPVTwz2FQdClPupgpjyTo3g0skIuTpUVXCqal ZIE8Pz5aoQiIYA7UanaDs8xBG3OdiyeuKmXFcKo+SJWHWkIEG/t3YtdOU5jB8zm8kZGt Lm/8D1Q6w7WAvVEw0MBtaoYUes2nWJOgsHlYHjSV67cgte8kGAwjxrwJpu957eknRhIs HoyznNRgPjhpKA8FWtkChpjPKPf9jei61bKehbFd6v2+LDoB2xlwZhIfBOUAz/i1+i2e 6RNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dmarc-filter :dkim-signature:dkim-signature; bh=vcUXiGMWtxc0vYK0jvkDbP1UcUK7m24b/BdjltZDac4=; b=u+toetEKULFJWAdsu6XRCztTL8CB0msJW7XEUbXBc2IsWruHkARPyjQFCR+T47fyTC EqY0iOJMxnn6GRUcrY/2nr52MlYkoLAZ5Yxm4Zpee7ZF+/VtXoNkYPzsLIHOm4VDBLuD XAQ2KxKd1qJJ0FXVKfnJeh+yAl+WFAX/k2fROvBxtVzaJdHXM7vIIQhdDo2+iQLTp/KI rCeRqz1uHEsZy/+jjU0nCArpliKHTAleE+V3krcPUB0hi9CLOnr4JOnzMqLl1mPg43vI jeCkQQ3Jg5QMExwkQScZUV/003fO19mJwRvWzhplpHRxLYsf6osimeNJtQKKpKYutTlh t+Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Mm28mot+; dkim=pass header.i=@codeaurora.org header.s=default header.b=dp0pSymG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si4885120pgv.328.2019.03.11.07.04.18; Mon, 11 Mar 2019 07:04:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Mm28mot+; dkim=pass header.i=@codeaurora.org header.s=default header.b=dp0pSymG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727744AbfCKODr (ORCPT + 99 others); Mon, 11 Mar 2019 10:03:47 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41300 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727469AbfCKODr (ORCPT ); Mon, 11 Mar 2019 10:03:47 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F25EB60DAD; Mon, 11 Mar 2019 14:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552313026; bh=rz3hpzhYgGZX+8d6angQRiM2LfoJqX1KFo32hfT+/ho=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Mm28mot+AnDLGjzpKCpXpJhjEF0veKfewlvbznM+Qd0Q0lap1JvORB0mp9xc55SEw wTRbTCbY1a8olx5fMINSpPNYxxtlm5SnGQ+u86y9c+GBt/t2D//FyEt41JL7jMpQ30 SqArGQtVZSlCSkOLnHihKCx/+dZjJuz8+Bsu8DBs= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from x230.qca.qualcomm.com (87-95-203-65.bb.dnainternet.fi [87.95.203.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B693260CED; Mon, 11 Mar 2019 14:03:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552313023; bh=rz3hpzhYgGZX+8d6angQRiM2LfoJqX1KFo32hfT+/ho=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dp0pSymG8EmWjTv0abskzeHgYzU+W61G9wg0vpDjEUmrrGQvtV/79aqrivAOENej6 KoBOlxtdNrVDuQSA5eA9DMRGvgiMApXcL4E6xfyF7uLtEJDEun2x7N/IK+fBaS5DM9 dALHH7z+0rP9opgHZg+DPBSavSPmB261T/cFWu1M= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B693260CED Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: ga58taw@mytum.de Cc: Julius Niedworok , linux-wireless@vger.kernel.org, david@redhat.com, nc@net.in.tum.de, Johannes Berg , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC v2] mac80211: debugfs option to force TX status frames References: <20190306200206.60916-1-julius.n@gmx.net> <87k1hazo6r.fsf@purkki.adurom.net> <20190307193045.a7awwn6mycloccq5@mission-control> Date: Mon, 11 Mar 2019 16:03:38 +0200 In-Reply-To: <20190307193045.a7awwn6mycloccq5@mission-control> (ga58taw@mytum.de's message of "Thu, 7 Mar 2019 20:30:45 +0100") Message-ID: <87h8c98q4l.fsf@codeaurora.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ga58taw@mytum.de writes: > On Thu, Mar 07, 2019 at 05:42:04PM +0200, Kalle Valo wrote: >> > + len = scnprintf(buf, sizeof(buf), "%d\n", (int)local->force_tx_status); >> >> I wonder about the cast, is it guaranteed that a bool is always of the >> same size as an int? > > Why is this a problem? If a bool is smaller than an int, the compiler > emits code that will prepend the value of force_tx_status with zeros. Let's say that a bool is a byte and int is four bytes. If you use "%d" I would guess that in that case scnprintf() writes 4 bytes, meaning that 3 bytes will be overwriting either padding or some other field in the struct. But I'm no compiler expert so I'm not going to argue about this anymore. I just wanted to point out that that the cast looks dangerous and I would not do it. -- Kalle Valo