Re: svn commit: r367771 - head/sbin/nvmecontrol

2020-11-17 Thread Jessica Clarke
On 17 Nov 2020, at 17:29, Jessica Clarke  wrote:
> On 17 Nov 2020, at 17:12, Adrian Chadd  wrote:
>> @@ -175,8 +176,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl
>>  errx(EX_OSERR, "unable to malloc %zd bytes", 
>> (size_t)max_xfer_size);
>> 
>>  while (resid > 0) {
>> -size = (resid >= (int32_t)max_xfer_size) ?
>> -max_xfer_size : resid;
>> +size = (resid >= max_xfer_size) ?  max_xfer_size : resid;
> 
> MIN from the already-included sys/param.h?
> 
> (Otherwise: you have an extra space after ?)

Also why is off signed when it counts up from 0?

Jess

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367771 - head/sbin/nvmecontrol

2020-11-17 Thread Jessica Clarke
On 17 Nov 2020, at 17:12, Adrian Chadd  wrote:
> @@ -175,8 +176,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl
>   errx(EX_OSERR, "unable to malloc %zd bytes", 
> (size_t)max_xfer_size);
> 
>   while (resid > 0) {
> - size = (resid >= (int32_t)max_xfer_size) ?
> - max_xfer_size : resid;
> + size = (resid >= max_xfer_size) ?  max_xfer_size : resid;

MIN from the already-included sys/param.h?

(Otherwise: you have an extra space after ?)

Jess

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367771 - head/sbin/nvmecontrol

2020-11-17 Thread Adrian Chadd
Author: adrian
Date: Tue Nov 17 17:12:28 2020
New Revision: 367771
URL: https://svnweb.freebsd.org/changeset/base/367771

Log:
  [nvmecontrol] Fix type signedness warning-to-error on gcc-6.4
  
  This fixes a type signedness comparison warning-to-error on
  gcc-6.4. The ternary operation casts it right but the actual
  assignment doesn't.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D26791

Modified:
  head/sbin/nvmecontrol/firmware.c

Modified: head/sbin/nvmecontrol/firmware.c
==
--- head/sbin/nvmecontrol/firmware.cTue Nov 17 17:11:07 2020
(r367770)
+++ head/sbin/nvmecontrol/firmware.cTue Nov 17 17:12:28 2020
(r367771)
@@ -159,8 +159,9 @@ static void
 update_firmware(int fd, uint8_t *payload, int32_t payload_size, uint8_t fwug)
 {
struct nvme_pt_command  pt;
-   uint64_tmax_xfer_size;
-   int32_t off, resid, size;
+   uint64_tmax_xfer_size;
+   int32_t off;
+   uint32_tresid, size;
void*chunk;
 
off = 0;
@@ -175,8 +176,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl
errx(EX_OSERR, "unable to malloc %zd bytes", 
(size_t)max_xfer_size);
 
while (resid > 0) {
-   size = (resid >= (int32_t)max_xfer_size) ?
-   max_xfer_size : resid;
+   size = (resid >= max_xfer_size) ?  max_xfer_size : resid;
memcpy(chunk, payload + off, size);
 
memset(, 0, sizeof(pt));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"