qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ssh: Remove unnecessary use of strlen function.
@ 2013-04-18 21:09 Richard W.M. Jones
  2013-04-18 21:24 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Richard W.M. Jones @ 2013-04-18 21:09 UTC (permalink / raw)
  To: qemu-trivial; +Cc: sw, qemu-devel

From: "Richard W.M. Jones" <rjones@redhat.com>

---
 block/ssh.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/ssh.c b/block/ssh.c
index 8f78e2e..7bc008d 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -387,15 +387,13 @@ static int check_host_key(BDRVSSHState *s, const char *host, int port,
     }
 
     /* host_key_check=md5:xx:yy:zz:... */
-    if (strlen(host_key_check) >= 4 &&
-        strncmp(host_key_check, "md5:", 4) == 0) {
+    if (strncmp(host_key_check, "md5:", 4) == 0) {
         return check_host_key_hash(s, &host_key_check[4],
                                    LIBSSH2_HOSTKEY_HASH_MD5, 16);
     }
 
     /* host_key_check=sha1:xx:yy:zz:... */
-    if (strlen(host_key_check) >= 5 &&
-        strncmp(host_key_check, "sha1:", 5) == 0) {
+    if (strncmp(host_key_check, "sha1:", 5) == 0) {
         return check_host_key_hash(s, &host_key_check[5],
                                    LIBSSH2_HOSTKEY_HASH_SHA1, 20);
     }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] ssh: Remove unnecessary use of strlen function.
  2013-04-18 21:09 [Qemu-devel] [PATCH] ssh: Remove unnecessary use of strlen function Richard W.M. Jones
@ 2013-04-18 21:24 ` Eric Blake
  2013-04-19  4:07 ` Stefan Weil
  2013-04-19  9:45 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2013-04-18 21:24 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: qemu-trivial, sw, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

On 04/18/2013 03:09 PM, Richard W.M. Jones wrote:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> ---
>  block/ssh.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] ssh: Remove unnecessary use of strlen function.
  2013-04-18 21:09 [Qemu-devel] [PATCH] ssh: Remove unnecessary use of strlen function Richard W.M. Jones
  2013-04-18 21:24 ` Eric Blake
@ 2013-04-19  4:07 ` Stefan Weil
  2013-04-19  9:45 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2013-04-19  4:07 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: qemu-trivial, qemu-devel

Am 18.04.2013 23:09, schrieb Richard W.M. Jones:
> From: "Richard W.M. Jones" <rjones@redhat.com>
>
> ---
>  block/ssh.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/block/ssh.c b/block/ssh.c
> index 8f78e2e..7bc008d 100644
> --- a/block/ssh.c
> +++ b/block/ssh.c
> @@ -387,15 +387,13 @@ static int check_host_key(BDRVSSHState *s, const char *host, int port,
>      }
>  
>      /* host_key_check=md5:xx:yy:zz:... */
> -    if (strlen(host_key_check) >= 4 &&
> -        strncmp(host_key_check, "md5:", 4) == 0) {
> +    if (strncmp(host_key_check, "md5:", 4) == 0) {
>          return check_host_key_hash(s, &host_key_check[4],
>                                     LIBSSH2_HOSTKEY_HASH_MD5, 16);
>      }
>  
>      /* host_key_check=sha1:xx:yy:zz:... */
> -    if (strlen(host_key_check) >= 5 &&
> -        strncmp(host_key_check, "sha1:", 5) == 0) {
> +    if (strncmp(host_key_check, "sha1:", 5) == 0) {
>          return check_host_key_hash(s, &host_key_check[5],
>                                     LIBSSH2_HOSTKEY_HASH_SHA1, 20);
>      }


Reviewed-by: Stefan Weil <sw@weilnetz.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] ssh: Remove unnecessary use of strlen function.
  2013-04-18 21:09 [Qemu-devel] [PATCH] ssh: Remove unnecessary use of strlen function Richard W.M. Jones
  2013-04-18 21:24 ` Eric Blake
  2013-04-19  4:07 ` Stefan Weil
@ 2013-04-19  9:45 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2013-04-19  9:45 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: qemu-trivial, sw, qemu-devel

On Thu, Apr 18, 2013 at 10:09:33PM +0100, Richard W.M. Jones wrote:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> ---
>  block/ssh.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-19  9:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18 21:09 [Qemu-devel] [PATCH] ssh: Remove unnecessary use of strlen function Richard W.M. Jones
2013-04-18 21:24 ` Eric Blake
2013-04-19  4:07 ` Stefan Weil
2013-04-19  9:45 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).