From patchwork Sat May 15 19:02:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michael_B=C3=BCsch?= X-Patchwork-Id: 12259965 X-Patchwork-Delegate: kvalo@adurom.com 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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham 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 CE44BC43460 for ; Sat, 15 May 2021 19:06:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB56C6127C for ; Sat, 15 May 2021 19:06:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234600AbhEOTIH (ORCPT ); Sat, 15 May 2021 15:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234608AbhEOTIE (ORCPT ); Sat, 15 May 2021 15:08:04 -0400 Received: from bues.ch (bues.ch [IPv6:2a01:138:9005::1:4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90046C06174A for ; Sat, 15 May 2021 12:06:49 -0700 (PDT) Received: by bues.ch with esmtpsa (Exim 4.92) (envelope-from ) id 1lhzcd-0004VQ-7m; Sat, 15 May 2021 21:06:47 +0200 Date: Sat, 15 May 2021 21:02:52 +0200 From: Michael =?utf-8?b?QsO8c2No?= To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Albert Herranz Subject: [PATCH] drivers/ssb/sdio: Don't overwrite const buffer if block_write fails Message-ID: <20210515210252.318be2ba@wiggum> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org It doesn't make sense to clobber the const driver-side buffer, if a write-to-device attempt failed. All other SSB variants (PCI, PCMCIA and SoC) also don't corrupt the buffer on any failure in block_write. Therefore, remove this memset from the SDIO variant. Signed-off-by: Michael Büsch Cc: stable@vger.kernel.org --- This memset has been introduced by the original patch that added SDIO support to SSB: 24ea602e183ca Better late than never. This change is only build tested, because I don't own the hardware. But to me this change looks reasonable. diff --git a/drivers/ssb/sdio.c b/drivers/ssb/sdio.c index 7fe0afb42234..66c5c2169704 100644 --- a/drivers/ssb/sdio.c +++ b/drivers/ssb/sdio.c @@ -411,7 +411,6 @@ static void ssb_sdio_block_write(struct ssb_device *dev, const void *buffer, sdio_claim_host(bus->host_sdio); if (unlikely(ssb_sdio_switch_core(bus, dev))) { error = -EIO; - memset((void *)buffer, 0xff, count); goto err_out; } offset |= bus->sdio_sbaddr & 0xffff;