SUPERH platform development
 help / color / mirror / Atom feed
From: Karl Nasrallah <knnspeed@aol.com>
To: linux-sh@vger.kernel.org
Subject: Re: can someone solve string_32.h issue for SH ?
Date: Tue, 17 Dec 2019 08:26:04 +0000	[thread overview]
Message-ID: <1401968064.233432.1576571164188@mail.yahoo.com> (raw)
In-Reply-To: <87h81zh4ap.wl-kuninori.morimoto.gx@renesas.com>

Well, this will teach me to try and solve a problem at 3 AM. Please ignore my last message.

strncpy behaves like this: linux (dot) die (dot) net/man/3/strncpy

Which is exactly what you just wrote. So yes, strncpy is expected to write null bytes when the source is shorter than n.

-----Original Message-----
From: Karl Nasrallah <knnspeed@aol.com>
To: kuninori.morimoto.gx <kuninori.morimoto.gx@renesas.com>
Cc: linux-sh <linux-sh@vger.kernel.org>
Sent: Tue, Dec 17, 2019 3:15 am
Subject: Re: can someone solve string_32.h issue for SH ?


Hello,

I'm terribly sorry; I think I made a mistake. I looked at it again, double-checked the defined behavior of strncpy, and I think you actually just need to replace __src+__n with __dest+__n in your strncpy.
Additionally, I don't know what the linux kernel rules are on this, but maybe unsigned long __dummy; should be initialized to 0 explicitly for readability?

Sorry about that!


-----Original Message-----
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Karl Nasrallah <knnspeed@aol.com>
Cc: linux-sh <linux-sh@vger.kernel.org>
Sent: Tue, Dec 17, 2019 2:46 am
Subject: Re: can someone solve string_32.h issue for SH ?



Hi Karl


> This appears to be your culprit:
> 
> char vub_name[3 + (9 * 8) + 4 + 1];
> 
> in struct vub300_mmc_host on line 302 of the file /drivers/mmc/host/vub300.c.
> 
> This is the exact line triggering your warning, also in vub300.c:
> 
> 515 strncpy(vub300->vub_name, "EMPTY Processing Disabled", sizeof(vub300->vub_name));
> 
> And the fix would be to probably fix vub300.c, do a sizeof() on the string or hardcode the string size to 26 characters since the string is already hardcoded in as it stands.
> 
> The asm doesn't look wrong.
> 
> Hope this helps!
> (Sorry I can't do any pretty formatting: mail client and majordomo don't play very well together and html gets generated at even the slightest provocation, despite having disabled it...)


Oops, indeed
I got too many this kind of warning on SH.
I though, it is SH side issue.
(Why I don't get same warning on other CPU.. ??)

But anyway, Thanks a lot.
I will fixup driver side !!

Thank you for your help !!
Best regards
---
Kuninori Morimoto

  parent reply	other threads:[~2019-12-17  8:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17  6:09 can someone solve string_32.h issue for SH ? Kuninori Morimoto
2019-12-17  7:36 ` Karl Nasrallah
2019-12-17  7:46 ` Kuninori Morimoto
2019-12-17  8:03 ` Kuninori Morimoto
2019-12-17  8:15 ` Karl Nasrallah
2019-12-17  8:26 ` Karl Nasrallah [this message]
2019-12-17  8:29 ` Geert Uytterhoeven
2019-12-17  8:37   ` Kuninori Morimoto
2019-12-17  8:43     ` Geert Uytterhoeven
2019-12-17  8:40   ` Geert Uytterhoeven
2019-12-17  8:51     ` Kuninori Morimoto
2019-12-17  9:09       ` Karl Nasrallah
2019-12-17 22:16         ` Karl Nasrallah
2019-12-17 23:13           ` Rich Felker
2019-12-17  8:50   ` Geert Uytterhoeven
     [not found] <339916914.636876.1576627652112.ref@mail.yahoo.com>
2019-12-18  0:07 ` Karl Nasrallah
2019-12-18  2:01   ` Kuninori Morimoto
2019-12-18  3:56     ` Karl Nasrallah
2019-12-18  5:21       ` Kuninori Morimoto
2019-12-18  6:06         ` Karl Nasrallah
2019-12-18  7:28           ` Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401968064.233432.1576571164188@mail.yahoo.com \
    --to=knnspeed@aol.com \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox