From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27589C433E0 for ; Fri, 5 Mar 2021 16:59:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF7AB64F1E for ; Fri, 5 Mar 2021 16:59:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbhCEQ6o (ORCPT ); Fri, 5 Mar 2021 11:58:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbhCEQ62 (ORCPT ); Fri, 5 Mar 2021 11:58:28 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1169C061574 for ; Fri, 5 Mar 2021 08:58:28 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id e7so2606543ile.7 for ; Fri, 05 Mar 2021 08:58:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4vO8xcvnT8HVccwtWoxEbb04shz3gXURd6cw0ZkJ788=; b=hQbCGTQacfSXl3aN6RY3VC17t4MdG4TXaf0bczaSMO22JPEn9FzTGlpKg/zW69AQ5C K0FvTMq4wqI1mlZTBD7VJL7cCAMwpsWIRc21mPo3nianED1W5dugh4H5aJnAOLK94LA8 44nu+yVCxgKtkBV2MzjnXvWr0w6RTGhe+dN5jW9uFXoeTr8fLwiJeTQ7Ig6n3dejjQ0K yLFoPbOo29MewmEKmGcJzoiO4/SKcCD83ACY/MsXypaD6whmvciL6nSnf6QClIdMu/Za njsmnwqgvtmYpi9imPe3NzlLIpDfaByFYp5/9CIiSHjYiyKQDQwNmtDc9yP+ootROufV 8kfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4vO8xcvnT8HVccwtWoxEbb04shz3gXURd6cw0ZkJ788=; b=pbVYKpdcTTP/v/dbA3c9QKahtTvv5aY/pduCEfajcqAQceqia/evWU6UEgKPNbEqPs GpL9BTJaw50S8Fhb/6BGz/IhnWQuIlYV85wz3wmHY9JZnkOd0uLN68V9jGff0h4pzxj+ +FOu111QJPOhUcvk+vuKKZwJ+O86y9SngihwqJE4tBPg7HpIrGn3+kPgkE9/MRBjCwMv +rVzM9LmS/L9izPwU4bH4UfAw55eONvA8AJGkqV6+IABDk1TSNZdCOiC2eEIWUaGCdB6 k9S/7xfgwM2t2sO+zAqAHzL7LoVC9O5lyf1PcfydJHAy1Fn2DzvzNXxb7G5YLz5pMOph pP1Q== X-Gm-Message-State: AOAM5328PVu8gbQzKS2wtgY4n3/afb4D68/fjXMP0uz+ojhCdHqf0pxj /W73OsT3ViQq1XTCKB9ES/HQpNIqxlcfIK5wFRg= X-Google-Smtp-Source: ABdhPJx7YKHGgBlYVqsKix+XPludpapU2KTmL2rf1P3Jsg8009eu+E/Ed7Vdr2kjtcDCX+yYfsAdWX8R87INj+HVato= X-Received: by 2002:a92:c5cf:: with SMTP id s15mr9624359ilt.149.1614963508365; Fri, 05 Mar 2021 08:58:28 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Edmundo Carmona Antoranz Date: Fri, 5 Mar 2021 10:58:17 -0600 Message-ID: Subject: Re: [PATCH] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() To: Dan Carpenter Cc: Larry Finger , Greg Kroah-Hartman , Michael Straube , Ivan Safonov , Kumar Kartikeya Dwivedi , Takashi Iwai , devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kernel-janitors@vger.kernel.org On Fri, Mar 5, 2021 at 2:59 AM Dan Carpenter wrote: > - if (sec_len > 0 && sec_len <= len) { > + if (sec_len > 0 && > + sec_len <= len && > + sec_len <= 32) { I wonder if this could be reduced to (sec_len > 0 && sec_len <= min(len, 32)) from a stylistic POV? First attempt at something kernel related so I know there's plenty of things to learn (including patterns for problems like this and etiquette). BR From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=1.0 required=3.0 tests=BAYES_05,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B19AC433DB for ; Fri, 5 Mar 2021 16:58:33 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3CF746507C for ; Fri, 5 Mar 2021 16:58:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CF746507C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id D291A43179; Fri, 5 Mar 2021 16:58:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QKlfhFMfFO7a; Fri, 5 Mar 2021 16:58:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id CDD2543306; Fri, 5 Mar 2021 16:58:31 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id BEA7B1BF29A for ; Fri, 5 Mar 2021 16:58:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B4DD9605F4 for ; Fri, 5 Mar 2021 16:58:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o92w2TSQZwLb for ; Fri, 5 Mar 2021 16:58:29 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by smtp3.osuosl.org (Postfix) with ESMTPS id 29570605F2 for ; Fri, 5 Mar 2021 16:58:29 +0000 (UTC) Received: by mail-il1-x136.google.com with SMTP id g9so2618908ilc.3 for ; Fri, 05 Mar 2021 08:58:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4vO8xcvnT8HVccwtWoxEbb04shz3gXURd6cw0ZkJ788=; b=hQbCGTQacfSXl3aN6RY3VC17t4MdG4TXaf0bczaSMO22JPEn9FzTGlpKg/zW69AQ5C K0FvTMq4wqI1mlZTBD7VJL7cCAMwpsWIRc21mPo3nianED1W5dugh4H5aJnAOLK94LA8 44nu+yVCxgKtkBV2MzjnXvWr0w6RTGhe+dN5jW9uFXoeTr8fLwiJeTQ7Ig6n3dejjQ0K yLFoPbOo29MewmEKmGcJzoiO4/SKcCD83ACY/MsXypaD6whmvciL6nSnf6QClIdMu/Za njsmnwqgvtmYpi9imPe3NzlLIpDfaByFYp5/9CIiSHjYiyKQDQwNmtDc9yP+ootROufV 8kfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4vO8xcvnT8HVccwtWoxEbb04shz3gXURd6cw0ZkJ788=; b=ishbMY773Zhb2vze89RgxiCNeAgbHDTtLvHm3BQiuv9Gb/JnpxNnFa71o8CZh7u1Gq YSPO/ApD4RTn9RGJ6AaJbxOelNOpBTX4EcDtoTNNFEMcjoDtM4E7MT/sT5VAZHvssF1o CjeH54RCOHoSwY0ofUapR+ysw+hDojyucn9kt+UPj88dnHvIpd0nwRhM1DerWHSaDNWL xslH1Jw3lp+ofg1E+YaIr6UaHFLfB5c65mzLYg+BShRbb0RMSKFOMHrpbp2wwdARZOKn nE9GIR8k7r96EehSPlZ1uByyBvhLCPFMGXj8n6kHVm0gpqyxVKrO9X9gIa/WnUuK0tBS b2HA== X-Gm-Message-State: AOAM530MVdCSSvbLY+vZPBQ1184rgUAqluy36dTzGiBQd6rnRSqvNCPB Ix5cACsLCqQDZUT8Mn8Ro2KC+CQUZkebqlLZEQw= X-Google-Smtp-Source: ABdhPJx7YKHGgBlYVqsKix+XPludpapU2KTmL2rf1P3Jsg8009eu+E/Ed7Vdr2kjtcDCX+yYfsAdWX8R87INj+HVato= X-Received: by 2002:a92:c5cf:: with SMTP id s15mr9624359ilt.149.1614963508365; Fri, 05 Mar 2021 08:58:28 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Edmundo Carmona Antoranz Date: Fri, 5 Mar 2021 10:58:17 -0600 Message-ID: Subject: Re: [PATCH] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() To: Dan Carpenter X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Ivan Safonov , Takashi Iwai , Greg Kroah-Hartman , kernel-janitors@vger.kernel.org, Kumar Kartikeya Dwivedi , Larry Finger Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Fri, Mar 5, 2021 at 2:59 AM Dan Carpenter wrote: > - if (sec_len > 0 && sec_len <= len) { > + if (sec_len > 0 && > + sec_len <= len && > + sec_len <= 32) { I wonder if this could be reduced to (sec_len > 0 && sec_len <= min(len, 32)) from a stylistic POV? First attempt at something kernel related so I know there's plenty of things to learn (including patterns for problems like this and etiquette). BR _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel