Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5661701ybi; Tue, 28 May 2019 17:22:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZilXEApbK5dK8RSOr3ms8xlRweRnxUTAmAUfv7GUEO4yaAmX2G4vaGKBl0AV0sZlom3fU X-Received: by 2002:a65:44c8:: with SMTP id g8mr136419690pgs.443.1559089367744; Tue, 28 May 2019 17:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559089367; cv=none; d=google.com; s=arc-20160816; b=hECyej5l6xPJQbmI92adSoFY/FXj9qxqnv6EeNiDMBrt91nUoNCqZ/gMMFv4fWQzJe pkKtRDUe5WTAwDGvtSpTnaaghn1jrectDHNsM5pdYjzgghqfITpB1nGIhb1/DJxb+B/A SytInX6CqVYUJLiZ+gvQhwKvz/HoE8bgplas6DjxtLWq1t/IhEA2Gw4PEjJZL2OsN5ac gv39CjmfUuJrIMF0EIVVflvC+PXIPcnvEpTdapvUNh6bp7onMaudFons17/2o8FRcuFf eLeQvFlLlvdA5rTau82Ld+JfjdkqpnkXadhrgs6zu5bVhQtGJ6OfncelQvSml+2y1+ck uZAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BtTsiX9fLP1ilIjEBEUD3JJBC+K61VnyY/gr7l2/6Ws=; b=cmdqVLH6vYHOMUIZRpjjya6FkyfeM9zIf4bwvL5nWoh/SwIK9NCizaF91F0EZPyU8R oWVe5gpPlRaTRRAkdCevh5UQ0TIQMOLz7gT0mEAIliQHTrffB5sgvNgoASAJhJugdTUv 5Mt2COG0QJgQih6GxOa928ZOmQtmTiNPTjpCU/RJLFAJxqSiPKhk/JK0koj+X1NB9ftQ Ffuey7OE6pq7VUrbcCdwv69uqJYGI5hURTn7OHFyuBK/w7NBKQ9DOXxKhZ5R1sXDCvkw IDhhRtOHOrWh9CsqQHm+1zc/yJ2JlfNMeE/3kU0z0arBKOoPAMSGUMAM2esgRLJ0f2HU xQXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NnONe+iz; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si24027386pgv.304.2019.05.28.17.22.29; Tue, 28 May 2019 17:22:47 -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=@gmail.com header.s=20161025 header.b=NnONe+iz; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727334AbfE2ATH (ORCPT + 99 others); Tue, 28 May 2019 20:19:07 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42074 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbfE2ATH (ORCPT ); Tue, 28 May 2019 20:19:07 -0400 Received: by mail-lj1-f195.google.com with SMTP id 188so614377ljf.9 for ; Tue, 28 May 2019 17:19:06 -0700 (PDT) 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=BtTsiX9fLP1ilIjEBEUD3JJBC+K61VnyY/gr7l2/6Ws=; b=NnONe+izAdPLfKUy8Po++z1ngR/rXmo0Qsl+xByZnGpvVdobMUqZHmA5KwfW7WvWn+ 3ANkzwb2vuN5lZMvzrHLkb+z4R+UVi8444eOuoN5YW4HeBzb8Z2ZJAWD69jp6XUnHar1 +qNsraJtJTttKc32/+WD3i0TVrlFXtFKXk+jc37zgkA+cqBcCfGpqCAMo35/NJ4l2bsd O12WI/FQQAfYCWItMDxaZTQFN3AKY88Rif42fUDNgbOVSGUJge4tIMx2SCB0GioKjJXY 9eQvgJudtOsEagr/IGzUNyv1kzMbDwpA4Ln4bQ/v5PcIdgTOKT6D+P/I4DS1JyUEU/X+ T/FA== 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=BtTsiX9fLP1ilIjEBEUD3JJBC+K61VnyY/gr7l2/6Ws=; b=R9A1sVo7Syju7LFHbOvaPn0olXhbCD7rbf3mdsipqd7a2ZUTQE0/Iv6JrRgOpKE7ih f/M0Zx5xaQOKk/kUzF5035QjUmFL5/Y/IIU2h8lA30b5Kondk09zT6hDmW4mX14Ip3Kh /3VYFDMx2XqhcTRzYmaw4XhLtnWpw438E4mN3kCTzEKlodGQepZanxIXhvnehJpc5E0q k6myGs/BwHIKZTjU5/L8po/wHdp3GP8iuJsW5QX200wsXArZx2c2Q5Y1Jhk32VttsQ3C gRdfZPfYavW7knUm/E34xee2/0MUPpSjquIaqR2XnM/8ykD1RIGdyT2y7PRgk1a08Q6C DqPw== X-Gm-Message-State: APjAAAX2432hNA4nUjFZMyVnOhgQIdwXk+ZNt7ijSvld7X7HbpTJCYZB wcLZTDtE+DNBZU2ixIS5X+QWXU4es2oEvZ7+XLQ= X-Received: by 2002:a2e:9b54:: with SMTP id o20mr4446799ljj.95.1559089145667; Tue, 28 May 2019 17:19:05 -0700 (PDT) MIME-Version: 1.0 References: <20190522004655.20138-1-fabiolima39@gmail.com> <20190522094130.GS31203@kadam> In-Reply-To: <20190522094130.GS31203@kadam> From: Fabio Lima Date: Tue, 28 May 2019 21:18:47 -0300 Message-ID: Subject: Re: [PATCH] staging: rtl8723bs: Add missing blank lines To: Dan Carpenter Cc: gregkh@linuxfoundation.org, jeremy@azazel.net, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em qua, 22 de mai de 2019 06:41, Dan Carpenter escreveu: > > On Tue, May 21, 2019 at 09:46:55PM -0300, Fabio Lima wrote: > > This patch resolves the following warning from checkpatch.pl > > WARNING: Missing a blank line after declarations > > > > Signed-off-by: Fabio Lima > > --- > > drivers/staging/rtl8723bs/core/rtw_debug.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c b/drivers/staging/rtl8723bs/core/rtw_debug.c > > index 9f8446ccf..853362381 100644 > > --- a/drivers/staging/rtl8723bs/core/rtw_debug.c > > +++ b/drivers/staging/rtl8723bs/core/rtw_debug.c > > @@ -382,6 +382,7 @@ ssize_t proc_set_roam_tgt_addr(struct file *file, const char __user *buffer, siz > > if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { > > > > int num = sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", addr, addr+1, addr+2, addr+3, addr+4, addr+5); > > + > > if (num == 6) > > memcpy(adapter->mlmepriv.roam_tgt_addr, addr, ETH_ALEN); > > > > I'm sorry but this function is really such nonsense. Can you send a > patch to re-write it instead? > > drivers/staging/rtl8723bs/core/rtw_debug.c > 371 ssize_t proc_set_roam_tgt_addr(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) > 372 { > 373 struct net_device *dev = data; > 374 struct adapter *adapter = (struct adapter *)rtw_netdev_priv(dev); > 375 > 376 char tmp[32]; > 377 u8 addr[ETH_ALEN]; > 378 > 379 if (count < 1) > > This check is silly. I guess the safest thing is to change it to: > if (count < sizeof(tmp)) > > 380 return -EFAULT; > > It should be return -EINVAL; > > 381 > 382 if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { > > Remove the check for if the user passes a NULL buffer, because that's > already handled in copy_from_user(). Return -EFAULT if copy_from_user() > fails. > > if (copy_from_user(tmp, buffer, sizeof(tmp))) > return -EFAULT; > > > 383 > > Extra blank line. > > 384 int num = sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", addr, addr+1, addr+2, addr+3, addr+4, addr+5); > > You will need to move the num declaration to the start of the function. > > 385 if (num == 6) > 386 memcpy(adapter->mlmepriv.roam_tgt_addr, addr, ETH_ALEN); > > If num != 6 then return -EINVAL; > > 387 > 388 DBG_871X("set roam_tgt_addr to "MAC_FMT"\n", MAC_ARG(adapter->mlmepriv.roam_tgt_addr)); > 389 } > 390 > 391 return count; > 392 } > > regards, > dan carpenter Thanks for your feedback. This is my first patch and I will send the second patch with modifications that you suggest. Fabio Lima